views:

41

answers:

2

Is there an easy way to submit all input elements on a page?

I have a very customisable page where the user can add and remove rows from multiple tables. The rows contain various different input elements. Do I have to put each table inside a form and then on submit have javascript to submit all the forms?

+1  A: 

If you want to submit all input elements, it's sufficient to have only one <form> that encircles them all. Calling form.submit() from JS or with a classic submit button then catches all input fields.

If you want a dynamic selection by the user, let her put inputs inside the form element for submission and outside to keep them where they are. This can be achieved with JavaScript.

Boldewyn
A: 
Tatu Ulmanen