Mastering Rails Forms Episode 2: Customizing Form Errors

Posted in Development, Frameworks, Web Technologies on December 18, 2008

Mastering Rails Forms Episode 2: Customizing Form Errors

Good forms help a user when trouble strikes. The default form error presentation is a start, but you should customize how form errors are presented to fit the needs of your users. Unfortunately, it’s not always obvious how to fully customize what Rails gives you. In this episode, we’ll completely customize the content of validation error messages and how form errors are displayed. We’ll finish up by validating the pizza form using AJAX. You’ll learn how to:

  • change the entire contents of any validation error message
  • customize the HTML (design and layout) of invalid form fields
  • make your application unique by writing a customized error_messages_for helper
  • display form errors inline next to invalid form fields
  • handle error messages added to “base”
  • validate forms before a submit using AJAX

Watch Video

Tags: Ruby, Ruby On Rails, Frameworks, Technologies, AJAX, The Pragmatic Programmers, Mastering Rails Forms