A normal form submit will pass a name/value pair to the server when clicking on an input type=submit or input type=image button. however, when I use the jquery validation plugin with form.submit() to submit the form, it only passes values if the type=submit, not if type=image.
To duplicate: Take the
demo/milk/index.html form and make two changes to it.
Replace the existing submitHandler code with the code below which passes "form" to the function and calls form.submit() so we can see the name/value pairs in the url.
- // specifying a submitHandler prevents the default submit, good for the demo
submitHandler: function(form) {
alert("submitted!");
form.submit();
},
The second change is to Add the following code underneath the existing signupsubmit button (it doesn't matter that the image doesn't exist).
- <input id="signupsubmit2" name="signup2" type="image" value="Signup" src="signup_btn.jpg" alt="sign me up" />
After making the two changes, fill out the form and click the first submit button, you will see the name/value pair of "&signup=Signup" in the url. When you click the 2nd submit button, the name/value pair is not passed. Normally you would either see "&signup2=Signup" or in IE you would see "&signup2_x=12&signup2_y=30" since IE passess the x,y coordinates of the click rather than the value.
without the name/value pair being passed to the server, we don't know which button got clicked to determine the correct action to take.
Is there a way for the Submithandler form.submit() to send the name/value pair for input type=image so it matches the same behaviour that a normal form submissions have? Thanks!!