question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValidationMessage for collection

See original GitHub issue

i validate a collection of strings to match some regex, and i want to show the error messages connected to the collection with the <ValidationMessage /> component. The errors are connected with property with index InputTagNames[0] but i can not get <ValidationMessage /> to map into that.

in the below image, the two rules that are highlighted are the implementation i wished to use but that i can not use. and below is my workaround with custom validation. The custom validation workaround loops the collection and add a ValidationFailure to the context, where i am able to set the property name to be the name of the collection, so when i display <ValidationMessage For="@(() => Model.InputTagNames)" /> it shows up correctly

Is there a better way i can map the collection to the ´<ValidationMessage />´?

image

image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
tgaardecommented, Jun 8, 2022

I found out i had other problems that might interfear. I validated manuel on an other instave of the object then the one connected to the editContext. Atm. Im going with my workaround

0reactions
Sharaf-Mansourcommented, Jun 8, 2022

@tgaarde Did you resolve the issue ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to add @Html.ValidationMessageFor for each item in ...
How to add @Html.ValidationMessageFor for each item in a collection? · c# · javascript · asp.net · asp.net-mvc-4 · unobtrusive-validation.
Read more >
ValidationMessage<TValue> Class
Gets or sets a collection of additional attributes that will be applied to the created div element. For. Specifies the field for which...
Read more >
Custom Validation in Blazor WebAssembly
All we do here is inherit from the MessageValidatorBase class and iterate through each message from the ValidationMessages collection.
Read more >
ValidationExtensions.ValidationMessage Method
Displays a validation message if an error exists for the specified entry in the ModelStateDictionary object.
Read more >
Telerik Validation Message for Blazor - Documentation
The Telerik Validation Message for Blazor adds customization options on top of the standard .NET ValidationMessage, such as Template and Class parameters.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found