用软键盘上的Go按钮替换为Phonegap中的Next [英] Replace Go button on soft keyboard with Next in Phonegap

查看:359
本文介绍了用软键盘上的Go按钮替换为Phonegap中的Next的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Phonegap输入类型文本显示软键盘上的Go按钮,我有多个文本框,所以希望在键盘上的下一个按钮,所以用户可以轻松地移动,最后输入想要的,所以用户可以按提交表单。

Phonegap input type text show Go button on soft keyboard, I have multiple text boxes so want Next button on keyboard so user can move easily and on last input want Go so user can press to submit form.

>

并且在Android kitkatt键盘顶部栏也不显示下一页|上一页按钮。

And on Android kitkatt keyboard top bar also not displaying Next|Prev buttons.

推荐答案

对于Android,现在不可能有​​一个下一步按钮而不是Go的输入类型=文本。

Having a "Next" button instead of "Go" for input type="text" would not be possible with Android as of now.

Android将始终显示表单输入字段的Go按钮,无论您在表单中所处字段的位置如何。 Go基本上反映了与在普通浏览器和浏览器上的Enter按钮相同的行为。键盘。

Android will always display "Go" button for form input fields irrespective of the position of the field you are at in the form. "Go" is basically reflecting the same behavior as of an "Enter" button on a normal browser & keyboard.

有两个可能的黑客来接近你需要的(仍然不会改变Go到下一步,但会帮助Go Next) -

There are two possible hacks to come closer to what you need (still won't change "Go" to "Next" but will help "Go" act as "Next") -

Hack 1 - Hijack Enter key event&将焦点移动到下一个字段

就像我提到的Go键复制了Enter键,可以使用JavaScript&使它将焦点移动到窗体中的下一个字段,直到它的最后一个字段。一旦最后一个字段到达,你可以允许它作为进入。所以基本上Go会继续移动焦点到下一个字段,直到它的最后一个字段&然后将提交表单。

Like I mentioned the "Go" key replicates the "Enter" key, you can capture the enter key event using JavaScript & make it move focus to next fields in form until its your last field. Once last field reaches you can allow it to act as enter. So basically Go will keep moving focus to next fields until its your last field & then will submit the form.

我已经回答了类似的要求的解决方案 - 如何在用户按Enter键时触发Tab键,您可以尝试在应用程序中实现相同的功能。

I have answered a solution to a similar requirement here - How to trigger a Tab when user presses Enter, you can try implementing the same in your app.

DEMO LINK - http://codepen.io/nitishdhar/pen/Gxbhm

Hack 2 - 强制表单验证&将焦点移至下一个无效字段

如果您希望阻止用户提交表单,可以使用java-script&如果一些字段未被填充,则在按下Go时,光标的焦点可以进入下一个未填充字段。因此,在某种程度上给人的印象 - 按下Go&移动到下一个字段以填充

If you want to prevent users from submitting the form, you can put required validations on the form using java-script & if some field is not filled, upon pressing "Go" the focus of the cursor can be brought to the next "not filled" field. So in a way giving the impression of - "Pressing Go & moving to next field to be filled"

尝试此插件 - http://jqueryvalidation.org/ 这种行为方式解释ie将焦点移动到下一个必需或无效字段。

Try this plugin - http://jqueryvalidation.org/ this behaves in the way explained i.e moves focus to the next required or invalid field.

此外,我认为一些Android版本在键盘上显示一些tab键在字段之间移动,但不是下一个。

Also I think some android versions show some tab key on the keyboard to move between fields, buts its not Next.

所有最好的。

这篇关于用软键盘上的Go按钮替换为Phonegap中的Next的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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