✅ Validate input in list in blazor forms
I have blazor EditForm with some inputs, the user can enter multiple people into the form, i handle that by having a button that adds some new fields in which the user can fill out new person. The
bind-value
for those inputs is the certain index list of people i have inside the main class for model (for example modelClass.People[5]
). Now i want to add input validation for example for email, but it doesn't get validated for the inputs that write inside the list. Anyone any idea how to make it work?
this is the relevant part of my code:
2 Replies
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.For anyone interested, i solved it by creating Component for Person and called it every time in the loop. I set the editcontext of the person form by hand. Than on submit i looped through every person and called context.Validate() and if any of the people returned false i didn't proced with the submiting.