I have designed a Registration form with the help of HTML. Here in the tage <form> I have given the action to the JSP page. (e.g. <form name="form1" action="sample.jsp">) .
I have to validate this form bu javascript. The form is validated on clicking the Submit button of the form. But the problem is that here the validation is done but at the same time the form is directed to the next page i.e. to sample.jsp
I wish that the form must be directed to the next page when all the validation is successful and the user does not need to change anything on the form.

You need to control the form submission based on the result of the validation.

<form name="frm" id="frm" action="action.jsp" onsubmit="return validate(this);">
  <!-- form elements go here -->
</form>

where validate returns a true or false depending on the outcome of the validation.

Is the name of the function validate() here??
Plzz expplain it..

You need to control the form submission based on the result of the validation.

<form name="frm" id="frm" action="action.jsp" onsubmit="return validate(this);">
  <!-- form elements go here -->
</form>

where validate returns a true or false depending on the outcome of the validation.

validate is your Javascript function which performs the validation. As I previously stated, make your validation function return a boolean flag depending on the result of the validation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.