I want to use some Scriptaculous effects on error messages.
<% form_for(@page) do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.error_message_on "name" %>
<%= f.label :content %>
<%= f.text_field :content %>
<%= f.error_message_on "content" %>
<%= f.submit 'Create' %>
<% end %>
My first idea is to put error messages into div tags and use page.visual_effect in the controller. But I don't know how to choose correct divs that will be affected.
<% form_for(@page) do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<div id="errorname"><%= f.error_message_on "name" %></div>
<%= f.label :content %>
<%= f.text_field :content %>
<div id="errorcontent"><%= f.error_message_on "content" %></div>
<%= f.submit 'Create' %>
<% end %>
Or should I put some if conditions into view and call them from there. By the way I don't know how to that. Can't we do something like f.error_message_on "name", :visual_effect => ...
Any help will be appreciated.