That's a copy and paste of the jQuery demo right? It works fine here.
Note: $("form") will grab all forms on the page.
What browser/OS are you testing this on?
Main Topics
Browse All TopicsI have a form in an asp.net page (using .Net 3.5, C#, and JQuery 1.3). I have failed to figure out how to get the form action="gotoawebpage" to function. If I use a straight-up old school HTML form with old school javascript when I hit "submit" the form goes to the place defined in the ACTION definition. But, when I place the form into the .net page using JQuery, I cannot get the form to go to another page, but it submits to itself only.
Ideas ??? I've attached my errant code below. Thanks in advance.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Yeah, I can grab the values out of the form ... no problem there. The problem is that when the form is submitted, it doesn't redirect / submit to the specified page.
In my sample (which was correctly identified as being ripped straight from the JQuery Documentation) I have form action="anypage.htm". The "action" means that it is supposed to go to "anypage.htm". This is what it doesn't do.
Problem exists in all broswers so it's not a browser issue, but a stupidity issue on my part. If I remove JQuery from the page, the "action" works and we go to "anypage.htm". I put the JQuery references back in and the "action" does not function.
All comments appreciated.
Please post a demo site or your full source.
window.location="somepage.
I have tested the code I posted verbatim with no problems (submits to anypage.htm) under most major browsers.
Try copy and pasting the code I posted and see if it still misbehaves.
I did try your code, both in it's complete state and in parts. It works as expected. In it's complete state it does redirect, it I take just the script and form portions it does not. You are probably correct that it is something else in the page and as nothing else has come to light I'm going to give you full solution credit. All I wanted was a push in the right direction and I think you helped me do that.
I can't post a demo site, unfortunately. I work in a highly structured environment and I'd have to have an approval chain along with dog and pony shows in order to put it anywhere where it might be publicly viewable. So, I'm going to look at the master page, the dependencies, inheritance, object model ... who knows if maybe our URL rewriter is the culprit. Help always appreciated; never expected.
Much thanks ... I appreciate the code sample you threw together.
Business Accounts
Answer for Membership
by: anoyesPosted on 2009-01-20 at 20:32:51ID: 23426859
First glance - on line 15 above, you've got " " quotes around form. I think you probably want to remove those and use the variable you've declared, as that'll target the specific form. In addition, #myForm references a form by ID, and you have only declared the name attribute on your form, not the ID attribute. Also, I would probably reverse your logic so that you check if firstname is not equal to correct.
Select allOpen in new window