获取 iPhone GO 按钮以提交表单

Getting iPhone GO button to submit form(获取 iPhone GO 按钮以提交表单)
本文介绍了获取 iPhone GO 按钮以提交表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

是否有人知道表单中有哪些变量可以使 iPhone 的虚拟键盘的 GO 按钮提交表单而不是提交表单?

Is anyone aware of what variables go into a form to make the iPhones virtual keyboard's GO button submit the form vs. not?

我一直在尝试缩小场景的范围,这就是我发现的:

I've been trying to narrow down the scenarios and this is what I've found:

  • 如果FORM只有一个用户输入框,go按钮自动提交表单

  • if FORM has only one user input field, go button automatically submits form

如果 FORM 有多个用户输入字段,但没有 INPUT TYPE="SUBMIT" 则 GO 按钮不会提交表单.

if FORM has more than one user input field, but no INPUT TYPE="SUBMIT" then the GO button does not submit the form.

如果 FORM 有多个用户输入字段并且有 INPUT TYPE="SUBMIT" 则 go 按钮会提交表单.

if FORM has more than one user input field AND has an INPUT TYPE="SUBMIT" then the go button does submit the form.

但是,这并不完全准确,因为我们遇到了第 3 次不适合我们的情况.

However, that's not completely accurate, as we're running into a situation the 3rd isn't working for us.

是否有人知道 GO 按钮工作与不工作的其他因素?

Is anyone aware of the other factors that go into the GO button working vs. not working?

推荐答案

所以,这是我们的具体问题:

So, here was our specific issue:

我们有一个包含多个用户输入字段的表单,但不是真正的 <input type="submit">(它是通过 JS 提交的).

We had a form with multiple user input fields, but not a true <input type="submit"> (it was being submitted via JS).

因此,GO 按钮什么也没做.

As such, the GO button did nothing.

然后我们添加了一个 <input type="submit"> 并将其设置为 display: none 希望这样可以解决问题.不.没用.

We then added an <input type="submit"> and set it to display: none hoping that would do the trick. Nope. Didn't work.

一时兴起,我们将 display: none 改为 margin-left: -1000px

On a whim, we changed display: none to margin-left: -1000px

成功了!

显然,Safari 正在寻找表单中是否存在 SUBMIT 按钮,并且只有当它没有显示:none 时,它才会在您点击 GO 按钮时触发它.

Apparently, Safari is looking for the presence of a SUBMIT button in the form and only if it's not display: none, it will then fire it when you hit the GO button.

这篇关于获取 iPhone GO 按钮以提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to resize UITextView on iOS when a keyboard appears?(出现键盘时如何在iOS上调整UITextView的大小?)
UIKeyboardFrameBeginUserInfoKey amp; UIKeyboardFrameEndUserInfoKey(UIKeyboardFrameBeginUserInfoKey amp;UIKeyboardFrameEndUserInfoKey)
iPhone - Keyboard hides TextField(iPhone - 键盘隐藏文本字段)
iPhone / iOS : Presenting HTML 5 Keyboard for Postal Codes(iPhone/iOS:为邮政编码呈现 HTML 5 键盘)
UISearchbar clearButton forces the keyboard to appear(UISearchbar clearButton 强制键盘出现)
Display keyboard without animation(没有动画的显示键盘)