How to make multiple forms with shared fields without using javascript?
<input type=text name=username />
<form action="/users">
... some fields ...
</form>
<form action="/admins">
... some another fields ...
</form>
It is no necessary to have the input tag inside the form: an input can be associated with its form using its form attribute.
It would be nice if forms could share inputs, but i haven't heard of this. Maybe we should ask W3C to introduce this in HTML6?
UPDATE: One workaround would be to have a single form with multiple "Submit" buttons, using <input type="submit" name="..." value="..." /> or <button type="submit" name="..." value="...">...</button> elements, so that all the fields get submitted when any button is pressed, and the server side can then check which button was pressed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With