[thelist] Validating Forms with Javascript Disabled

Martin martin at lists.evolt.org
Sat Sep 2 10:21:56 CDT 2000


Gregory.John.Toland at census.gov wrote on 30/8/00 11:05 pm

>What is the best method to validating form entries with Javascript 
>disabled?  I
>assume I  include the code (that would normally have executed on the client
>side) in the program defined by the ACTION attribute.  If there is an 
>error in
>the entry (i.e. form field is blank) how do I redirect the user back to 
>the page
>containing the form, but without resetting all the fields to blank (i.e. any
>fields with entries retain their values)?  Any advice or web sites with
>examples?  Thanks so much for any help you could give.

Greg

You need to do server-side validation (always a good idea even if you're
100% certain that your JS will catch it all).

Instead of redirecting back to the form, what you could do is just output
a page which *looks* like the original form, but with the non-problem
fields pre-populated with what the user put in before.

Or even more radical, don't output those as editable fields at all. Put 
them in as
text as a reassurance (and carry the data as hidden fields), but only let
the user touch the fields which still have problems.

Naturally this is a recursive process.


Cheers
Martin

------------------------------------------------------------------------
email: martin at members.evolt.org              PGP ID: 0xA835CCCB
  tel: +44 (0)778 068 6418                snailmail: 30 Shandon Place
 http://evolt.org/index.cfm?menu=9&uid=32            Edinburgh, Scotland





More information about the thelist mailing list