Search code examples
ruby-on-railsruby-on-rails-3textfieldemailfield

Rails: How "email_field" differs from "text_field"?


I understand that text_field creates an input field of type text, while email_field creates an input field of type email.

But, what is the difference between these two input types ?

Say I have a client model while a client has an email. Should I use email_field here ?


Solution

  • The email field is the new html 5 input which right now behaves the same on most of the machines with the exception of a few mobile devices such as the iphone where it switches to a different keyboard.

    You can find more about it by googling html5 email field.

    It's just a touch of finesse which some users will appreciate.