I have a data driven form generated on the fly from a database. The requirement is that certain form elements can become hidden depending on answers from previous form fields.
For e.g. if we have 3 fields, field 1 is a radiobutton list and if the 1st selection is made then field 3 needs to be hidden as its no longer needed. The rules are stored in the database as well but in a very crude manner. The question is how to render the fields in the View in such a manner so that the jQuery can also be incorporated in such a way which is similar to hard coded page with jquery to hide/show fields.
I have a data driven form generated on the fly from a database. The
Share
If you don’t want to use jQuery to hard-code the rules into the page, you can use Ajax on the various “trigger” elements to go back to the server and hit the database to determine which elements to show, based on that. You could simply return a string, for example, containing the form elements you wish to show/hide.
This string of elements could be the actual jQuery selectors, which would make your jQuery code pretty simple.
That’s the best answer I can give you, based on the limited information we have regarding the rules used for showing/hiding elements.