PhoneGap的Andr​​oid的GO按钮,不提交表单 [英] phonegap android GO button to not submit form

查看:140
本文介绍了PhoneGap的Andr​​oid的GO按钮,不提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写与PhoneGap的应用程序,我有一个通过AJAX发送注册表单。结果当你点击注册按钮执行 formcheck()函数它工作正常。然而,当我从我的Andr​​oid手机打了 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 :)

这篇关于PhoneGap的Andr​​oid的GO按钮,不提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆