I have a form that has a section with a dynamic number of inputs, depending on the options the user has chosen. When the configuration posts back to the server, I want to concatenate the different values of that section into an xml string and store them in the database as one value. The possible combinations of fields are finite; each of the three 开发者_运维百科possibilities is built as a partial view that I include on load, and reload via ajax if the dropdown specifying the type of config changes.
Each partial view is typed, and has validation properties associated with it.
Here's what I want to do: Upon the submit button being clicked, I want validation to run against all fields, but before actually submitting the form, I want to invoke a script to build the xml string and store it in a hidden input.
How do I "inject" a step between the validation and submission without having to do a bunch of custom work?
Why does it matter that it be done after validation? Just hook your submit button clicked event, then call submit. So it does a little work if the form isn't valid. Not a huge deal really.
精彩评论