PDA

View Full Version : Resolved two onSubmits on one form



owt200x
12-22-2008, 04:05 PM
1) Script Title: Required field(s) validation and Submit Once! Form validation

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex16/requiredcheck.htm
and
http://www.dynamicdrive.com/dynamicindex11/submitonce.htm
3) Describe problem:
I have been trying to get this to work but everything I do only one or the other works. What I am trying is to have both of the scripts above on my form and run one after another using the onSubmit tag below.

<form onSubmit="return formCheck(this); && submitonce(this)">
Is this the right way to do this? or is there another way to have the validation run then the submit once run

thanks,
Barry "OwT"

jscheuer1
12-22-2008, 04:35 PM
No, and even doing it the right way might cause a conflict between the two scripts. But, that said, the proper method would be:


onsubmit="return (formCheck(this) && submitonce(this));"

owt200x
12-22-2008, 05:46 PM
thanks John, I'll put that in there. Hopefully theres no conflict between those 2 scripts, if there is, then I dont know what to do.

jscheuer1
12-22-2008, 06:33 PM
If there is, post a link to your page, as in:

Please post a link to the page on your site that contains the problematic code so we can check it out.

Most conflicts are fairly easy for me to resolve once I see the two scripts attempting to function together on a live page.

owt200x
12-22-2008, 08:24 PM
I only have the submitonce code in it right now, I was wanting to add the validation script to save bandwidth.

my contact form is at http://www.owt200x.us/contactform

their are two demo forms, one uses OpenCaptcha, the other uses MathCaptcha
the code is also on the site for download it you wanted to look at it

jscheuer1
12-23-2008, 03:36 AM
There are no obvious script errors or conflicts on that page. What's the problem?

owt200x
12-23-2008, 07:02 AM
the problem was I didn't know how to have two onSubmits but you showed me how. thank you. I don't have both the scripts on the page right now, I was waiting until I could get both in the onSubmit. It only has the submitonce script