Jeetandra,

Change this line:

out.println("<p><small><small><input type=\"submit\" value=\"Add Complaint\"
name=\"Add\"
onClick=\"chgcase()\">");

To this:

out.println("<p><small><small><input type=\"button\" value=\"Add Complaint\"
name=\"Add\"
onClick=\"chgcase()\">");

The fact that your type is submit in the original line is causing the
browser to submit the form regardless of what happens in chgcase ().

If everything is validated in chgcase (), use the submit () method of the
form object to submit the data.  You may need to pass your form to chgcase
as in chgcase (form) so that chgcase can know who the form is without
specifying a full object path to the form.

Hope this helps.

Brian

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Jeetandra Mahtani
Sent: Wednesday, May 26, 1999 9:59 AM
To: [EMAIL PROTECTED]
Subject: client side validation to reduce overhead


I have been using a servlet to perform the validation of the values entered
by a user in a
form. To reduce the overhead, I am trying to use client-side validation
using Javascript.
Is it possible to overcome the following problem:
I have a form with several fields. Now, the action of this form is a
script(servlet) that
will take the values and add them to a table.
out.println("<p><small><small><input type=\"submit\" value=\"Add Complaint\"
name=\"Add\"
onClick=\"chgcase()\">");
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

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.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

___________________________________________________________________________
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

Reply via email to