• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Webpage redirection problem

 
abrar alvi
Ranch Hand
Posts: 66
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am new to JavaScripts , I have a problem in redirecting my page after clicking sumbit


Note: before redirecting first i have to perform form validation.

Here is my code:




Please help me...
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can only either do a form submit, or change the page to a different window.location.href, not both.
 
abrar alvi
Ranch Hand
Posts: 66
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok so how do i validate my form first and then redirect it to a different page....
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't "redirect"a form, you can only submit it. Remove the onclick handler from the submit button, and move it to the onsubmit handler of the from. The method should return "true" if the form should be submitted, or "false" if not. The URL it should be submitted to goes into the "action" attribute of the form tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic