Type attribute for text_field

Posted by Koning Baard XIV on Stack Overflow See other posts from Stack Overflow or by Koning Baard XIV
Published on 2010-04-02T13:00:25Z Indexed on 2010/04/02 13:03 UTC
Read the original article Hit count: 475

Filed under:
|
|
|
|

I have this code:

<%= f.text_field :email, :type => "email", :placeholder => "[email protected]" %>

So people can enter their email on an iPhone with the email keyboard instead of the ASCII keyboard. However, the output is:

<input id="user_email" name="user[email]" placeholder="[email protected]" size="30" type="text" />

which should be:

<input id="user_email" name="user[email]" placeholder="[email protected]" size="30" type="email" />

Is there a way to force Rails to use the email type instead of text, or must I use HTML directly? Thanks

© Stack Overflow or respective owner

Related posts about rails

Related posts about input