Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple form ID's in HTML5's input form attribute

Tags:

html

forms

The HTML5 input element includes a 'form' attribute, which can contain one or more space delimited form id's. See below for a simplified example, where both form1 and form2 share an input element.

<form id="form1" method="post">
    <input type="submit">
</form>

<form id="form2" method="post">
    <input type="submit">
</form>

<input type="text" form="form1 form2">

At least, that's how it's supposed to work:
http://swatelier.info/at/forms/HTML5attrib.asp
http://www.w3schools.com/tags/att_input_form.asp

In Chrome 28, I see that adding a second form id hides an input element from both forms. What modern browsers, if any, support this functionality?

like image 643
pkinsky Avatar asked Jul 31 '13 02:07

pkinsky


People also ask

Can we use multiple form tag in HTML?

Yes, we can use multiple tags inside one single HTML page. Sometimes we need to submit two distinct data from a single HTML page. To do so we need to use multiple tags.

In which input field more than one value can be selected?

The multiple attribute is a boolean attribute. When present, it specifies that the user is allowed to enter more than one value in the <input> element. Note: The multiple attribute works with the following input types: email, and file.

What is form ATTR?

The action attribute defines the action to be performed when the form is submitted. Usually, the form data is sent to a file on the server when the user clicks on the submit button. In the example below, the form data is sent to a file called "action_page.php".


1 Answers

Nowhere in the spec says that the value of the form attribute is a space-separated list of IDs of form elements in the document:

If a reassociateable form-associated element has a form attribute specified, then that attribute's value must be the ID of a form element in the element's owner Document.

Source: WHATWG HTML5 specification

like image 186
rink.attendant.6 Avatar answered Oct 17 '22 05:10

rink.attendant.6