获取iPhone GO按钮提交表单 [英] Getting iPhone GO button to submit form
问题描述
是否有人知道哪些变量进入表单以使iPhone虚拟键盘的GO按钮提交表单而不是?
我一直在尝试缩小这是我发现的情况:如果FORM只有一个用户输入字段,那么go按钮会自动提交form 如果FORM有多个用户输入字段,但没有INPUT TYPE =SUBMIT,那么GO按钮不会提交表单。
>如果FORM有多个用户输入字段并且有一个INPUT TYPE =SUBMIT,那么go按钮会提交表单。
然而,这并不完全准确,因为我们遇到了第三种情况不适合我们的情况。
是否有人知道进入GO按钮的其他因素是否正常工作?
所以,这里是我们的具体问题:
我们有一个包含多个用户输入字段的表单,但不是真正的< input type =submit>
(它通过JS提交)。 b
$ b
然后我们添加了一个< input type =submit>
,并将其设置为 display:none
希望可以做到这一点。不。没有工作。
一时兴起,我们将display:none更改为 margin-left:-1000px
有效!
显然,Safari正在查找表单中是否存在SUBMIT按钮,它不是显示:没有,它会在你点击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:
if FORM has only one user input field, go button automatically submits form
if FORM has more than one user input field, but no INPUT TYPE="SUBMIT" then the GO button does not submit the form.
if FORM has more than one user input field AND has an INPUT TYPE="SUBMIT" then the go button does submit the form.
However, that's not completely accurate, as we're running into a situation the 3rd isn't working for us.
Is anyone aware of the other factors that go into the GO button working vs. not working?
So, here was our specific issue:
We had a form with multiple user input fields, but not a true <input type="submit">
(it was being submitted via JS).
As such, the GO button did nothing.
We then added an <input type="submit">
and set it to display: none
hoping that would do the trick. Nope. Didn't work.
On a whim, we changed display: none to margin-left: -1000px
That worked!
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按钮提交表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!