I have a couple fields in a form.
On the iphone, when people are filling out their stuff, there is a "GO" button on the keyboard. Accidentally click this will submit the form
How can I use JQuery to return false whenever the "GO" button is pushed, bu开发者_开发技巧t instead only submit the form when the "submit" button is clicked?
You can remove the action
tag from your <form>
and then submit your form in your tap action.
Something like:
$('#submit').tap(function() {
$.post('formsubmit_url.html', $("#formID").serialize());
});
I'm not sure this is something you should try to do - it'll just be an arbitrary difference between your form and other web forms, and will frustrate some users. I couldn't find anything in the Apple documentation, so I suspect there's no way to do what you want.
Instead of changing the behaviour that your users expect to be there, how about you just add some validation to the form so it can't be submitted unless the proper fields have been filled out?
精彩评论