10

Is it possible to attach an input element to more than one form? I know HTML5 allows you to specify a form an element belongs to by form's ID. But is it possible to attach it to like multiple ID's?

It seems nice to do all that without any javascript/JQuery, which is the alternative.

2
  • 1
    what are you trying to achieve? Commented Jun 12, 2013 at 8:52
  • I have several forms that do a search, in different ways, and wanted to add a common field to all those forms. The thing is I dont want to redo the whole page to make them all to one form (which I should have done in the first place, but don't want to do that now) Commented Jun 12, 2013 at 9:29

1 Answer 1

12

No, a form control can be associated with only one form.

From w3c specification:

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.

You can use a single, large form and decide (on the server) which inputs to pay attention to based on which submit button was pressed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.