PhoneGap的Android的GO按钮,不提交表单
我在写与PhoneGap的应用程序,我有一个通过AJAX发送注册表单。结果当你点击注册按钮执行 formcheck()
函数它工作正常。然而,当我从我的Android手机打了 GO
按钮将其提交,而不是通过持续的形式 formcheck()
处理。我想:
I'm writing an app with Phonegap and I have a register form that is sent through ajax.
It works fine when you hit the register button and execute the formcheck()
function. However, when I hit the GO
button from my android phone it submits the form instead of going through the formcheck()
process. I tried:
<form id="RegForm" onsubmit="formcheck();return false;">
我的状态没有适当提交按钮,但像这样的按钮:
My form has no proper submit button but a button like this:
<input type="button" id="submitbtn" onclick="formcheck()"/>
我也试图创建一个新OnSubmitForm()
调用 formcheck()
之一,但无功能无济于事。结果谢谢你帮助。
I also tried to create a new OnSubmitForm()
function that calls the formcheck()
one but with no avail.
Thank you for helping.
找到了!
1),将其添加到JS部分:
1) Add this to the JS section:
$(document).ready(function() {
$("#YourFormName").submit(function() {
FormCheck();
return false;
});
});
function FormCheck() {
... validation process here ...
}
2)确保在您的表单提交按钮。(&LT;输入类型=提交
)
希望这会帮助别人,所以我5小时努力和放大器;测试时间不会去浪费:)
Hope it'll help others so my 5 hour trying & testing time won't go wasted :)