Form sending twice

R

Rick

I have a form that calls a perl script. A few javascript routines in
the form do a few things prior to submitting. For some reason,
however, the perl script is being called twice (the perl script sends
out an email, and submitting the form once results in two identical
emails.)

Here are excerpts from the script that I believe to be relevant (I can
post more if this isn't enough, but it's long and I'm trying to keep
it brief.) Can anyone tell me what I'm doing wrong? I've read about
how you need to return true after calling the javascript via a button
click, but I've done this kind of thing in other places and it's
worked fine. I've also tried inserting a return statement here in the
function and it doesn't seem to make a difference. Strange. (BTW, I
changed the domain name in the URL out of courtesy to my client, just
FYI.)

---------

<script language="javascript">
function sendFormNow(theForm)
{
toggleVis ('sendbutton');
toggleVis ('progressbar');

theForm.submit();
}

[...]

<form action="http://cgi.mysitedomain.com/cgi-bin/alertmail.cgi"
method="post">

[...]

<input type="submit" value="send" onClick="sendFormNow(this.form);">

[...]

</form>
 
S

Stuart Palmer

don't submit the form in the JS. the form action is alreadying going to be
doing this for you.
That might be the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top