[thelist] Calling onSubmit from within a script

jeff jeff at members.evolt.org
Thu Mar 29 18:15:26 CST 2001


gerd,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: Gerd Baumann
:
: > Jeff Howden wrote:
:
: >   window.onload = onLoad;
:
: Thanks Jeff, from a fan with limited JS
: knowledge.  Following your recommendations,
: I was wondering if I could possibly call an
: onSubmit event from within a script, too. I
: tried this, but without luck:
:
: document.f.pw.onSubmit = noInput;
:
: What is my mistake?
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

the first mistake is the capitalization of the event handler in the script.
event handlers within script are *always* lowercase.

the second mistake i notice is your object reference.  i assume your form is
named "f" and you have a form field named "pw".  the form itself is what has
the onsubmit event handler, not the form field.

so, in conclusion, your call to your function should look like this:

document.f.onsubmit = noInput;

good luck,

.jeff

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





More information about the thelist mailing list