I've never had that problem,
eg
<script>
function test()
{ return true; }
</script>
.
.
.
<form action="page2.htm" method="post" onsubmit="return test();">
<input type="Submit">
</form>
will submit but
<script>
function test()
{ return false; }
</script>
.
.
.
<form action="page2.htm" method="post" onsubmit="return test();">
<input type="Submit">
</form>
won't submit..
Haven't tried it under Linux /NS though..
The only issue I've had with onsubmit is that it doesn't get called when you
use document.forms[0].submit();
~Justin
---
From: "Niall O Broin" <niall at magicgoeshere.com>
To: <webdev at linux.ie>
Sent: Sunday, September 24, 2000 2:20 PM
Subject: [Webdev] Javascript onsubmit() driving me bonkers !
> I've just wasted more than an hour trying to make an onsubmit handler work
> properly. I could not stop the form submit from happening, despite my best
> efforts. If the onsubmit handler returns false, the form should not be
> submitted. It transpires that this is only correct for certain vales of
> false ! For example:
>> Handler
>> onsubmit="return false"
>> Result
>> Form will not be submitted, as expected.
>> Handler
>> onsubmit="var do_sub=false; return do_sub"
>> Result
>> Form will not be submitted, as expected.
>> Handler
>> onsubmit="return form_check()"
>> where form_check is some function which is doing whatever checking we
want.
>> Result
>> Form will always be submitted, no matter what form_check() returns.
>> Handler
>> onsubmit="var do_sub=form_check(); return do_sub"
>> Result
>> Form will always be submitted, no matter what form_check() returns.
>>> This is all with Communicator 4.72[en] under Linux - didn't check with
other
> browsers - if the bug is there, I have to work around it.
>> The eventual solution was
>> Handler
>> onsubmit="if (form_check()) { return true } else { return false }"
>> Result
>> Form will be submitted or not, depending on what form_check() returns -
> which is exactly what I want. Note that I did verify what form_check() was
> returning by appropriate Alerts.
>> Is this weird or what ? Who can I sue for my hour back :-)
>> Regards,
>>> Niall O Broin
>> _______________________________________________
> Webdev mailing list
>Webdev at linux.ie>http://www.linux.ie/mailman/listinfo/webdev>>
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!