I have a HTML form with several inputs. The required fields are controlled by one combobox in the form. That means that the required fields are dynamically assigned according to the combo.
Now I am controlling this behaviour in code, the validation function check if all the required fields (according to the property of the combo) are filled, otherway the required fields are shown in red.
For me this approach has two disadvantadges:
- There is an overload on the server, checking, on any change of the form, if the required fields are filled or not.
- I have no way to generate a view to define the required fields by the user. Everything is in source code.
I have been thinking how to store this info in the DB to solve both problems, but all the solution force me to store names of properties/fields on the DB that maybe could change on the future. And it is not clear how to propagate this info into the ViewModels.
Do you have any suggestions? How do you solve this recurrent problem?
Thanks in advance.
The application is developed on ASP .NET MVC