[thelist] javascript & forms

Jeff jeff at members.evolt.org
Mon Apr 3 14:44:31 2000


teresa,

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: <Teresa_Molina@hartehanks.com>
:
: What also works is moving the "action=" to the JavaScript.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

i would suggest against using the submit() method and no ACTION in the
<FORM> tag.  by doing this you've immediately discriminated against any user
that chooses to disable javascript or surf with a non-js browser.  see below
for why it won't work for non-js users.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: WARNING!: The form has been known to reset in the
: situation, so please be aware of this before implementing.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

it's not actually resetting.  since there is no ACTION attribut in the
<FORM> tag the page simply posts to itself for non-js users.  also, if there
are any errors in your validate() function then it will not set the action
in the function and will submit back to itself too.

:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Also,if you're using a textarea box, which is where most people
: hit enter, add "wrap=physical" to the tag so the user doesn't feel
: the need to return.
:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

this isn't necessary as the enter key is interpreted as a line break within
a textarea.  in fact, the only key that doesn't do what it normally does is
the tab key which moves to the next element.

good luck,

.jeff

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