Click to See Complete Forum and Search --> : Trouble with a Pair of Form Scripts


satellitenoise
07-03-2003, 06:33 PM
Okay, so apologies in advance for being a beginner with javascript. I've been having trouble getting two scripts to work together. The first is an e-mail validation script (http://javascript.internet.com/forms/val-no-alert.html) which doesn't pop up an alert dialog box, but instead swaps an image with the alert message. The second script (http://javascript.internet.com/forms/submit-link.html), allows me to use a link as a submit button, which I like because it allows me to keep my mouse-overs intact. Both scripts work fine on their own. If I use the first script and a standard submit button, it executes perfectly. But the second script (which is only one short line within the link (javascript:document.subscribeform.submit();), I believe may be causing the problem, since the first script is not activated, though the form is submitted. If anyone has some suggestions as to a path I might take to rewrite these to be more compatible together, I would be quite greatful.

karayan
07-03-2003, 06:54 PM
I'm not sure I understand your problem. If you are saying that you want to replace the default button on the first script with a link that should work like the second script, then you can do it like so:

The link should invoke the first script. For example:

<a href="" onClick="validateform(this)">Submit</a>

The <form> tag should have the onSubmit event property.

Then, at the end of the validateform() function, if all is well and we are ready to submit, you can include the document.subscribeform.submit() method call.

I haven't tried this, but seems to me it should work.