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: Michael Winter <m.winter@blueyonder.co.uk>
Date: Tue Jan 10 2006 - 15:47:59 CET

On 10/01/2006 13:48, VK wrote:

[snip]

> By having a simple button (instead of submit) you are free from any
> hassles to *return* anything (right away or any later). [...] So I admit missing
> the ridiculousness of this approach?

It is ridiculous because there is no hassle. I can only imagine that the
OP didn't notice the difference between his

   <form ... onsubmit="checkDates();">

and

   <form ... onsubmit="return checkDates();">

Furthermore, it's ridiculous in its excessiveness. Compare

   <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>

to

   <form action="..." method="post"
         onsubmit="return validate(this);"
>
     <!-- ... -->
   </form>

and then try and tell us, with a straight face, that the former is the
simpler, hassle-free option.

Mike

-- 
Michael Winter
Prefix subject with [News] before replying by e-mail.
Received on Tue Jan 17 17:07:31 2006