Re: Form validation
by "Steve Mount" <steve(at)saltyrain.com>
|
| Date: |
Thu, 30 May 2002 15:23:13 -0400 |
| To: |
"rudy" <r937(at)interlog.com>, <amcbainezzell(at)alum.mit.edu>, <hwg-techniques(at)hwg.org> |
| References: |
rudy |
| |
todo: View
Thread,
Original
|
|
I teach a course in basic JavaScript and CGI, and always tell my students to
always check forms in both JS and on the server. If the user does not have
JS, or has it disabled, the server validation will catch it. But for the
majority of users, having validation in JS will make their experience better
(assuming, of course, your JS is correct and valid!).
I also always tell them to be careful about blanking out anything the user
ever types in himself. If you blank out the other text box when the user
checks a different radio button, then the user will have to retype all that
if they made a mistake. No a good usability feature. Even if they submit
with something in the other text box with a non-other radio button checked,
I'd let that go - the JS can blank out the other box before submission, or,
better, the server-side can ignore the other text box if the other radio
button was not checked.
The user is your friend - serve her as best you can.
But, because the user is, well, a user, always always always check on the
server side, which is the only place you have total control.
-------------------------------------------------------------
Steve Mount, Software Engineer steve(at)saltyrain.com
Home Site http://www.saltyrain.com
US Constitution Online http://www.usconstitution.net
----- Original Message -----
From: "rudy" <r937(at)interlog.com>
To: <amcbainezzell(at)alum.mit.edu>; <hwg-techniques(at)hwg.org>
Sent: Thursday, May 30, 2002 2:27 PM
Subject: Re: Form validation
> > Which do you think is the better approach
>
> of the two options listed? 1
>
> > Other approaches?
>
> yes, another approach is not to check it with javascript
>
> the reason i say this is because your server logic has to check it again
> anyway, and what do you intend to do if the "other" box is filled in but a
> different radio button is checked? your choices in this case are
>
> -- accept the non-other radio button choice
> -- accept the other text
> -- reject the form and redisplay
>
> if you do the third, then yes, by all means you should implement the 1st
of
> your two javascript behaviours
>
> just bear in mind that people without javascript will be submitting too,
> and so you still have to do the server side check
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA
This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.