>I am performing clientside Javascript validation of the fields by using a
>function ( called
>on clicking the Sumbit button of the form). If there is a problem, an alert
>box is brought
>up telling the user what the error is, but if the user clicks on the OK
>button of the alert
>box, they are taken to the next page ( ie. the page mentioned in the
>action-servlet ). Any
>way to prevent this until no alert boxes are displayed.
>Thanks
When calling your validation-function with onSubmit, you have
to let your function return 'true' or 'false'.
When 'true' the action will be executed.
When 'false' nothing will happen:
An example:
function checkInput(obj) {
for (i = 0; i < obj.length; i++) {
if (obj.elements[i] == "") {
alert('You have to fill in every field!');
return false;
}
return true;
}
}
<FORM ... onSubmit="return checkInput(this);">
Note: it is important not to forget 'return' in your
onSubmit-statement.
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html