Problem related to JSP and Javascript

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Nov 2008
Posts: 5
Reputation: kdhanshree is an unknown quantity at this point 
Solved Threads: 0
kdhanshree kdhanshree is offline Offline
Newbie Poster

Problem related to JSP and Javascript

 
0
  #1
Nov 14th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,609
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Problem related to JSP and Javascript

 
0
  #2
Nov 15th, 2008
You need to control the form submission based on the result of the validation.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <form name="frm" id="frm" action="action.jsp" onsubmit="return validate(this);">
  2. <!-- form elements go here -->
  3. </form>
where validate returns a true or false depending on the outcome of the validation.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: kdhanshree is an unknown quantity at this point 
Solved Threads: 0
kdhanshree kdhanshree is offline Offline
Newbie Poster

Re: Problem related to JSP and Javascript

 
0
  #3
Nov 15th, 2008
Is the name of the function validate() here??
Plzz expplain it..




Originally Posted by ~s.o.s~ View Post
You need to control the form submission based on the result of the validation.
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <form name="frm" id="frm" action="action.jsp" onsubmit="return validate(this);">
  2. <!-- form elements go here -->
  3. </form>
where validate returns a true or false depending on the outcome of the validation.
Reply With Quote Quick reply to this message  
Join Date: Jun 2006
Posts: 7,609
Reputation: ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of ~s.o.s~ has much to be proud of 
Solved Threads: 464
Super Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Failure as a human

Re: Problem related to JSP and Javascript

 
0
  #4
Nov 15th, 2008
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.
I don't accept change; I don't deserve to live.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC