Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

html - Getting iPhone GO button to submit form

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...