We have two separate forms that need to be submitted together.
The first form gathers certain information.
The second form gathers more information and the submit images for both forms are contained within this form.
The first submit image submits the first form to a servlet to be validated. If it comes back OK, then the second submit button will actually submit both forms together.
This is what we want to be able to do. Can this be done? Does someone have the JavaScript or whatever that would help us do this?
I might be missing something here, but won't it be easier to simply send the entire form through once (form 1 and 2), and see if entries in form 1 validate.
If they do, go ahead and process the forms (email, add to database, whatever). But if form 1 entries do not "validate", simply return back from your script displaying an error on the resulting page. The user can hit back and correct the entries - then resubmit.
I would go about using Perl I think - makes more sense - however PHP, or even Javascript validation would seem okay.
I agree with zeeshan that sending the entire form would be better/easier, or using JavaScript validation instead.
However, if you absolutely need both forms merged into one to submit, you could use JavaScript to grab the values from the first form, and assign them to hidden form fields of the second form. Seems like a lot of hassle to me, but it's an option.
Actually, JavaScript form field validation would be an option but unfortunately these particular fields in the first form need to be checked against a database for validity before the second form can be sent through; etc. ... Any more ideas?
Is there a reason why you can't send the info from the second form when you send in the first? You don't have to do anything with the information but why can you not just send it along and leave it alone unless the first info checks out?
Bookmarks