I have an web page where form input elements are in different places and cannot be physically contained within the same form. What’s the best approach to include these input values in the form submission?
Note that I want to perform an actual post submission, not an AJAX submission.
Add an onsubmit handler to the form, and in the handler copy the values from the various inputs to hidden inputs that are in the form.
Note however that this will (obviously) not work for users with JavaScript turned off.
Sorry about the somewhat ugly code – just whipped something up off the top of my head. If you’re interested you could do all of the above in about three lines of jQuery…