[thelist] JavaScript - form.submit()

Jeff Howden jeff at members.evolt
Tue Aug 1 13:13:57 CDT 2000


scott & anthony,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "Anthony Baratta" <Anthony at Baratta.com>
:
: You don't need the submit() function if you are executing
: the javascript via the onSubmit event. Its redundant, they
: collided - you lost. ;-)
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

it's redundant, but you'd be surprised how many so-called experts teach
people to do it this way.  it's sad.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: If you use the input type=image, you also don't need the submit()
: function - since clicking that is equivalent to using a submit button.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

true.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: If you decided to use a type=button or a straight image (so you can
: do rollovers), you use the onClick event and then you'll need the
: submit() function in your Java Script to submit the form.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

in a world-accessible situation i would suggest that the submit() method be
abandoned period.  it just doesn't pay to render your forms completely
useless to non-js users.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: (Therefore, you won't need the onSubmit event in your form tag
: with a button or straight image.)
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

in fact, the onSubmit event handler isn't even called when you submit the
form using the submit() method.  can you imagine the endless loop scott's
little validation routine would have gotten into if it fired the onSubmit
event handler every time the submit() method was called, in turn calling the
validation function again, calling the submit() method again, firing the
onSubmit event handler again, ad nauseum.  yikes!

hope this clarifies,

.jeff

name://jeff.howden
game://web.development
http://www.evolt.org/
mailto:jeff at members.evolt.org






More information about the thelist mailing list