By default, an element appearing within a <form> element is associated with that form and will thus be treated as part of that form’s content and behavior. The following form element types are automatically associated in this way:
- <input />
- <object> (non-form element)
The beuty of the form attribute is that allows of the above mentioned elements to be manually re-associated with a different form on the page by adding a form attribute to the relevant element to be re-associated to. The value of the form attribute must be equal to the id of the form that the element is to be re-associated with (see example below).
<input type="submit" value="Submit Alternate Form" form="other_form" />
Example with form attirbute:
No comments have been made yet.
Please login to leave a comment. Login now