Setting default input modes

When you want to limit the user input to some character set, you can make the users's life easier by setting the default input mode. This is useful for zip-codes, email addresses etc.

Of course, each carrier handles this a bit differently, and also differently if the markup is xhtml.

To be on the safe side, it is better to handle this separately for each carrier, or at least break docomo and non-docomo handling.

For xhtml markup, the following will do.

Initial mode

docomo

au, Softbank

Fullwidth hiragana

<input type="text" name="kana" style="-wap-input-format:"*<ja:h>"" />

<input type="text" name="kana-l" istyle="1" mode="hiragana" style="-wap-input-format:*M;"/>

Halfwidth-kana

<input type="text" name="hankana" style="-wap-input-format:"*<ja:hk>"" />

<input type="text" name="hankana-l" istyle="2" mode="hankakukana" style="-wap-input-format:*M;"/>

Alphabet

<input type="text" name="roman-wd" style="-wap-input-format:"*<ja:en>"" />

<input type="text" name="roman-l" istyle="3" mode="alphabet" style="-wap-input-format:*m;"/>

Numeric

<input type="text" name="numbers" style="-wap-input-format:"*<ja:n>"" />

<input type="text" name="numbers-l" istyle="4" mode="numeric" style="-wap-input-format:*N;" />

Note

Numeric mode set this way will actually lock the input to numeric mode on au handsets.



Historic addendum

According to some sources it is possible to combine everything, in the following way. However, as there are buggy handsets out there this is discouraged. Handsets we know are faulty are: 930SH, W64SH.

Fullwidth-hiragana

<input type="text" name="kana" istyle="1" format="*M" mode="hiragana" style="-wap-input-format:&quot;*&lt;ja:h&gt;&quot;;-wap-input-format:*M;" />

Halfwidth-kana (same as previous on au)

<input type="text" name="hankana" istyle="2" format="*M" mode="hankakukana" style="-wap-input-format:&quot;*&lt;ja:hk&gt;&quot;;-wap-input-format:*M;" />

Alphabet

<input type="text" name="roman" istyle="3" format="*m" mode="alphabet" style="-wap-input-format:&quot;*&lt;ja:en&gt;&quot;;-wap-input-format:*m;" />

Numbers

<input type="text" name="numbers" istyle="4" format="*N" mode="numeric" style="-wap-input-format:&quot;*&lt;ja:n&gt;&quot;;-wap-input-format:*N;" />

References

* http://mocamoca.biz/blog/2008/04/xhtml.html


Categories: Mobile Development

InputModes (last edited 2011-01-19 07:13:14 by PaulMcMahon)