0

I have a ruby on rails website which is designed mobile's view. In this web, I have 2 input: email and zip code which is define input[type=email] and input[type=tel] respectively. I checked this view in Safari browser and 2 above inputs work correctly - it mean the keyboard display @ in email field and numeric keyboard in zip code field. I used this website (or webview exactly) to make IOS webview application, however 2 above inputs is still input[type=text] and the keyboard only display text keyboard. This is html my code: - email field:

<input type="email" name="user_email" id="user_mail" maxlength="300" size="30" >
zip code field:
<input type="tel" name="zip_code" id="zip_code" maxlength="8" size="10" placeholder="1050001" >
What are reasons and solution of this issue? Please help me. Thank you.
Phuc TM
  • 13
  • 4

1 Answers1

0

For iOS webview to display numeric only, you have to have pattern="[0-9]*" at the zip code field.

<input type="tel" name="zip_code" pattern="[0-9]*" id="zip_code" maxlength="8" size="10" placeholder="1050001">

Reference: iPhone / iOS : Presenting HTML 5 Keyboard for Postal Codes

JackyW
  • 345
  • 2
  • 11