10

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>
Jonah Katz
  • 5,230
  • 16
  • 67
  • 90

2 Answers2

16

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| %>
Blacksad
  • 14,906
  • 15
  • 70
  • 81
  • thanks but actually just realized it needs to go in the form_for tag, but when i add that it gets skipped.. heres what i did:`<%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :novalidate => 'novalidate') do |f| %>` – Jonah Katz Aug 15 '11 at 14:24
  • 2
    Don't worry... in this case use: <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => {:novalidate => 'novalidate'}) do |f| %> – Blacksad Aug 15 '11 at 14:30
  • Perfect! (need 15 characters to post :) – Jonah Katz Aug 15 '11 at 14:34
-1

RICH EDITOR - such as the stack over flow will be better for you.

Tinymce is a great rich editor.

check out this website: http://richonrails.com/articles/adding-tinymce-to-your-rails-application

When you follow the instructions make sure you do the following also.

  1. run gem install tinymce-rails on your command prompt
  2. Add <%= tinymce %> on the bottom of your footer or footers or your layouts and not your forms (I have my footer as a partial, so this text is in every page assuming that is what you want.)
  3. Make sure you restart your serverr or else you will get all type of errors.

Hope this helps answer your questions

Lesly Revenge
  • 894
  • 10
  • 16