How can I put the error messages generated by the validation


#1

Hello,

I’m a newbie, coming from Visual FoxPro - a database centric and object
orientated scripting language with a rich set of graphical user
interface controlls. Lerning ruby on rails means for me to lern html as
well. But now to my

problem:
The validation errors are listed at the top of the page without any
order. Depending on the size of the form and the numbers of errors
listed the data entry fields containing the corresponding invalid data
eventually are out of sight. If the user corrected the value of a field
the corresponding error message should indicate that something was done.

idea:

  1. Bring the error messages into a meaningful order (there have already
    been posts covering this task)
  2. Display the error messages in a side frame with it’s own scrollbar.
  3. Make a specific part of the message interactive, so a click of the
    user on this part will take him right a way to the corresponding data
    entry field.
  4. Change the color of the error message if the field entry was changed.

implementation:
???

Thanks in advance

Jochen


#2

For now, you can use my plugin (see signature) to order your fields. I
was
only 3 days into Ruby/Rails when I wrote it so it definitely needs to be
refactored. Eventually, I’ll submit it as patch. As for the display and
location, CSS and Javascript are your friends.

Another option if you want to get personal, is to generate your own
error
handling/display using the error_on function.

Bob S.
http://www.railtie.net/


#3
  1. Display the error messages in a side frame with it’s own scrollbar.

Ugh. Don’t do that. Scrolling subcontainers or side frames are rarely
good UI decisions in HTML pages. If you have so many validation errors
that the list is very long, consider placing the error messages adjacent
to the fields instead of in a group.

  1. Make a specific part of the message interactive, so a click of the
    user on this part will take him right a way to the corresponding data
    entry field.

Great idea. Use the Prototype javascript library to set focus on the
field you get the error on. Make sure that the focus is very very
obvious, since simply setting the cursor in the field isn’t easy to
notice.

  1. Change the color of the error message if the field entry was changed.

I think this is also a great idea. You’ll might want to submit your form
when the user tabs away from each field, and update a div with the
relevant errors. The trick is to make sure you don’t display an error
for a field the user hasn’t yet put a value into. That’s where it gets a
little tricky, since you probably also want to insure certain fields
aren’t empty.