File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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: 42950
    
  72
You can only either do a form submit, or change the page to a different window.location.href, not both.
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: 42950
    
  72
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Webpage redirection problem