[Javascript] Q on grabbing ONSUBMIT..

David Lovering dlovering at gazos.com
Fri Oct 31 06:59:29 CST 2003


First off, assigning the action to a null string doesn't work very well
across a wide cross-section of browsers.  A much better method is as
follows:

action='javascript:void(null)'

To kill the submission of the form (which you've effectively set in motion
by setting the action as described), the routine called by onSubmit (or
whatever name-variation is this weeks W3C favorite) merely needs to return
false.   At least that's the way I interpret the fine print, and so far my
interpretation hasn't blown up any of my various web-apps.

-- Dave Lovering

----- Original Message ----- 
From: "Walter Torres" <walter at torres.ws>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Friday, October 31, 2003 3:28 AM
Subject: [Javascript] Q on grabbing ONSUBMIT..


> I have this bit...
>
>
> <form action=""
>       id="demo"
>       name="demo"
>       method="post"
>       onsubmit="return doForm ( this, document )">
>
> It works just fine.
>
> This method checks some things and then returns a TRUE or FALSE, and the
> FORM is sent based upon that returned value.
>
> Fine, but...
>
> I thought I knew how, but I'm at a loss this early in the morning.
>
> How can I "grab" the 'onSubmit' event, do my checks and then have my
method
> decide to send the form or not.
>
> In other words, I don't want to have the 'onSubmit' attribute on the FORM
> Object Tag.
>
> I just want to INCLUDE a JS file, and the FORM on that page will be
handled.
>
> Oh, also, it needs to handle multiple FORMS on a single page.
>
> Any ideas form those who are brighter than I?
>
> Thanks
>
> Walter
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>





More information about the Javascript mailing list