Re: 'Lost' function return value: what am I doing wrong?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: 'Lost' function return value: what am I doing wrong?

From: VK <schools_ring@yahoo.com>
Date: Tue Jan 10 2006 - 14:48:26 CET

Michael Winter wrote:
> On 09/01/2006 18:26, VK wrote:
>
> [snip]
>
> > <form method="POST" action="your_URL">
> >
> > <!-- your form flow -->
> >
> > <script type="text/javascript">
> > var b = '<input type="button" value="Submit" ';
> > b+= 'onclick="validate(this.form)">';
> > document.write(b);
> > </script>
> >
> > <noscript>
> > <input type = "submit" value="Submit">
> > </noscript>
> > </form>
>
> Why on Earth would the OP want to do something as ridiculous as that?

That was my answer to:

bdobby@fish.co.uk wrote:
> Thanks for that, but I still have a couple of questions:
>
> 1. Is it not the case that the semantics of onsubmit are such that if
> it returns false the form is not submitted? How does this work if the
> return value is always discarded?
>
> 2. More importantly, is there any way to do what I want to do, namely
> to override onsubmit without losing the return value of the original
> method?

By having a simple button (instead of submit) you are free from any
hassles to *return* anything (right away or any later). At it is
perfectly degradable in case of JavaScript disabled. So I admit missing
the ridiculousness of this approach?
Received on Tue Jan 17 17:07:27 2006