Error message like form_for


/ Published in: Other
Save to your folder(s)



Copy this code and paste it in your HTML
  1. If not using the form_for/tabular_form_for to display errors - this is a way to cleanly display
  2. the first error. Putting the li tags will make it appear like the standard rails form_for generated
  3. error list.
  4.  
  5. <%= error_message_on(@account, "owner_id", "<li>", "</li>", "error_message") %>
  6. # returns: <div class="error_message"><li>can't be blank</li></div>"

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.