views:

54

answers:

2

How to make multiple forms with shared fields?

<input type=text name=username />
<form action="/users">
    ... some fields ...
</form>
<form action="/admins">
    ... some another fields ...
</form>
+3  A: 

Having two forms share an element is not possible without JavaScript.

You can't have two form elements overlap or nest each other; so, a form element can't be in two forms at once.

What do you want to achieve?

Pekka
Sorry, now I know that I can't resolve the problem without js. The question is updated
SMiX
+1  A: 

You really only need one form if youre processing server side. just use array naming for the form fields and submit buttons like:

global[my-field-name]
action[specific-submit-action]
specific-submit-action[my-field-name]

then in what ever you are using to process you can merge/combine the specific-submit-action and global arrays/hashes and do things with the data depending on the action[specific-submit-action].

prodigitalson