开发者

How do I make it so that you cannot click "GO" to submit the form (iPhone), but must tap the "submit" button?

开发者 https://www.devze.com 2023-02-12 14:26 出处:网络
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

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号