PDA

View Full Version : can Netscape do JS validation on an image field?


dragonday
01-05-2001, 10:45 AM
Does anyone know if Netscape 4.72 can do multiple validation (check for correct email and make sure that checkbox is ticked), on an IMAGE FIELD item in a form?

Or do I have to use a standard button (as provided by Dreamweaver)???

Any help would be appreciated...

kdjoergensen
01-05-2001, 12:12 PM
Yes, you can attach an event handler to the input tag also when the type is set to image:

<input type="image" onclick="return checkData(this.form)" href="...">

Just make sure the checkData() has an if/else branching like this:

function checkData(form){
if (form.element....) {
//everything is ok
...
...
form.submit();
return true;
} else {
//input is missing
alert('sorry fill in all fields');
return false;
}
}