开发者

Controlling initial shift status (and layout?) of iPhone keyboard from web form

开发者 https://www.devze.com 2022-12-14 11:56 出处:网络
I would like to be able to control the initial shift state of the iPhone keyboard from a Javascript prompt (updates added for web forms). It seems to mostly default to an initial capital but I feel su

I would like to be able to control the initial shift state of the iPhone keyboard from a Javascript prompt (updates added for web forms). It seems to mostly default to an initial capital but I feel sure I've typed into/seen prompts that are initially lower-case. I also feel sure that I've seen custom layouts used from the开发者_开发百科 web.

Googling around initially (see updates) didn't reveal any obvious documentation or previous answers besides saying that having "phone" or "zip" in the class of the input would bring up the numeric keyboard (although this may have stopped working). Apparently "url" or "email" could select the appropriate layouts also. This obviously doesn't apply to javascript prompts, and may not work in some versions.

Is there any official source for all this stuff? Does it work across all firmware versions? Has anyone got a general solution for changing keyboard layout or for doing this in Javascript prompts?

UPDATE For web forms: found this from Apple straight after posting the question, along with this. The question still stands for Javascript prompts.

UPDATE 2 Doh! This is also useful; placeholder text and search button not mentioned in the Apple links. Some more relevant info here.


How do I control which keyboard is displayed when a user touches a text field? You can control which type of keyboard is displayed when a user touches a text field in a web page. To display a telephone keypad, an email keyboard, or a URL keyboard, use the tel, email, or url keywords for the type attribute on an input element, respectively. To display a numeric keyboard, set the value of the pattern attribute to "[0-9]" or "\d".

These keywords and the pattern attribute are part of HTML 5, and are available in iPhone OS 3.1 and later. See Listing 15 to see how to display each type of keyboard, including the standard keyboard.

Listing 15: Controlling keyboard display Text: Telephone: URL: Email: Zip Code:

See http://developer.apple.com/library/safari/#codinghowtos/Mobile/UserExperience/index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消