Occasionally, you will find yourself in a situation where you might need to post more than once. For example, when the form doesn't pass validation, the user is returned to the form, and must post again once they have made corrections.
You may want to change some fields on the page during this first post, so that when the user returns, he sees something different. Or, you may want to set a hidden field to indicate something. You cannot do this if the model field is bound to an element on the view. It is important to understand that the model is bound to the element and only element. If you are going to return to the view, you can't break this binding even if you set the field to something else in the action method.
If you absolutely need to do this, you can use JavaScript/jQuery connected to the submit button to set the field on the page.
No comments:
Post a Comment