Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Javascript form validation


Message #1 by "Al Higgs" <al.higgs@b...> on Sun, 17 Feb 2002 15:08:46
You can create a label next to the textbox, but with empty text.
when the validation fails, populate the label with the
error message you want.
As for the dissappearance of the stuff, check if you only
display them when the page is initially loaded.  make sure
the the page postback, you also display them.
hope it helps.


-----Original Message-----
From: Al Higgs [mailto:al.higgs@b...]
Sent: Sunday, February 17, 2002 7:09 AM
To: javascript
Subject: [javascript] Javascript form validation


Hello,

I am using some simple javascript to validate a form, in the following way

function ValidateForm() {
 if (document.address.s_street.value == "") {
 document.write( "Please enter something here")
return false
 }
}

Problem is when the form is submitted the content of the page dissapears 
and
the page simply shows Please enter something here.  Is there any way of
getting this error message to appear next to the appropriate text box?

Any help appreciated

Al Higgs

  Return to Index