RE: validating forms without Javascript
by "Lauri Vain" <lauri_vain(at)tharapita.com>
|
Date: |
Wed, 27 Mar 2002 21:48:41 +0200 |
To: |
<hwg-basics(at)hwg.org> |
In-Reply-To: |
lanl |
|
todo: View
Thread,
Original
|
|
Hi Regina,
> How would I validate a form without Javascript? The
> only way I know how is using Javascript.
As Darrell already pointed out -- you do that with a server-side script.
You usually simply code that into the script that sends out the form
data via e-mail, enters it into the database or flat data file.
> Is validation even necessary?
Oftentimes the answer is a resounding "Yes!". Other times -- it won't be
needed at all.
Let's say that you have an ordering form, then you absolutely SHOULD
verify that the data (especially the e-mail address) is valid. The best
solution would be to code the server side validation function first and
later add the JavaScript validation. The JavaScript validation is good
because it can tell you right away whether the e-mail address has a
valid form or if it's even entered (and not left blank). In other words
-- you put less strain on your server because the user is made to enter
all fields at first and then the server side validation will also be
conducted (to make sure that some malicious users didn't play around
with the data... this stage is also for those that don't have JS
enabled).
Data validation becomes even more critical in the case of an e-commerce
site -- it would be unwise not to check the data (ok, the transaction
servers do that as well, but it never hurts to spare round trips to some
distant server).
On the other hand -- when you want people to sign your guestbook, then
you would only validate the "message" field or the "name" field or
whatever (depending on your preferences). You don't need to implement
any validation at all if you don't want to in this case... Validation,
however, is *required* on more critical systems and tasks.
Hope this helps!
Thanks,
Lauri
--
Tharapita Creations
[server-client web applications]
lauri.vain(at)tharapita.com
Mobile: +372 53 410 610
HTML: hwg-basics mailing list archives,
maintained by Webmasters @ IWA