ValidationMessage for collectionSee 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 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 />´?
- Created a year ago
Top GitHub Comments
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