Tuesday, January 12, 2010

[Rails] Re: Multiple validations on a field... grouping them? only o

Danimal wrote:
> Hello!
>
> Has anyone come across a nice, elegant way to handle multiple
> validation failures on a single field? For example... in the typical
> login, you might have an email field that has three validations: not
> blank, less than a max length and matches a format regex. But if I
> submit the login/signup form with a blank I get back:
>
> # Email address is too short (minimum is 6 characters)
> # Email address should look like an email address.
> # Email address can't be blank
>
> I'd rather be able to specify (cleanly and easily) on a model some
> kind of order of importance and then only show the first validation
> failure for that field.

Why? As a user, I find it extremely annoying when I fix one validation
error, submit the form, and get shown a different error. I'd rather see
all the validation errors at once so I can fix them all at the same
time.

>
> Thoughts? Advice?

Don't do that. :)

>
> TIA!
>
> -Danimal

Best,
-- 
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
--
Posted via http://www.ruby-forum.com/.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate