Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add attribute to rails helper text field?

I have a rails helper text field from devise that uses html and atomatically validates the type="email" field. I want to add the attribute novalidate='novalidate' to it, but i do not know how.. Heres the code.. any suggestions?

<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)
) do |f| %>
  <p><%= f.label :login %><br />
  <%= f.email_field :login %></p>
like image 956
Jonah Katz Avatar asked Aug 15 '11 14:08

Jonah Katz


1 Answers

Just do:

<%= f.email_field :login, :novalidate => 'novalidate' %>

UPDATE -- If you want to add an attribute to the FORM tag, the syntax is slightly different:

<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:novalidate => 'novalidate'}) do |f| %>
like image 54
Blacksad Avatar answered Nov 08 '22 04:11

Blacksad