Welcome to WebmasterWorld Guest from 220.127.116.11
Forum Moderators: phranque
Essentially I have split a registration form into two as I require some of the content to be stored in a database and some of the content (a word document upload file) to be sent via email.
However the problem I'm getting is that users are completing the first form and not the second therefore was wondering if it was possible to submit both forms with only one button unlike to the two I'm using at present.
I don't want the first form to be submitted unless there are values in the second form.
Can anyone offer any advice or alternatives?
Something like onClick="CheckForms()"; to initiate the process.
Use the CheckForms() function to verify all your data is correct.
to submit your forms.
Try this [w3schools.com] as a starting point.
Hope that's of some help.
Another method is to have the second form on a second page which has the submit routne on the onLoad method. The page never really shows, it appears that the final page loads twice.
I would just make it one form and then let your script that handles the form sort out what to do with everything.
Send all your values to your script let it drop all appropriate values into the DB and then send off the doc and throw up a thankyou page or whatever happens next.
If the two forms must be submitted together 100% of the time it would only make sense. I would think you could combine your two scripts together with only mild difficulty making sure they don't step on each others toes.
I do see that sometimes it is necessary to be able to post two forms simultaneously, especially in the environment where two forms are independent. For example, trying to integrate two different web applications, and both of them have forms on different parts of the page... There are at least two possible ways that I can think of.
<iframe name="dummy" width="0" height="0"></iframe>
document.Form1.target = 'dummy';
var obj = document.all ? // Check whether it is MSIE
new ActiveXObject("Msxml2.XMLHTTP") : // MSIE
new XMLHttpRequest(); // Mozilla
As you can see, it only works for MSIE > 5 and Mozilla. But who cares about other players anyway :)