aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Webpage redirection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Webpage redirection problem " Watch "Webpage redirection problem " New topic
Author

Webpage redirection problem

abrar alvi
Ranch Hand

Joined: Feb 01, 2012
Posts: 66

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
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
You can only either do a form submit, or change the page to a different window.location.href, not both.


Ping & DNS - updated with new look and Ping home screen widget
abrar alvi
Ranch Hand

Joined: Feb 01, 2012
Posts: 66

Ok so how do i validate my form first and then redirect it to a different page....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39537
    
  27
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.
 
Don't get me started about those stupid light bulbs.
 
subject: Webpage redirection problem
 
Similar Threads
jQuery not working on page
struts-2 (set values to action class)
Problems with form validation
how to delete the rows which are checked
javaScipt onsubmit problem in jsp