I want my first check to verify email address uniqueness. If this validation fails, there's no reason to go further with validating the user's input. I want a singular message displayed in this case. Is there a way to do this? Also, what about group validations, such that, for example, if I have several checks on a password (existence, complexity, confirmation) and one fails, the others are ignored. So for instance, if the password field does not match its confirmation, I skip validating the password complexity. What's the best approach to this? Thanks.
on 2009-02-14 01:31
on 2009-02-14 12:17
On Feb 13, 11:29 pm, ericindc <firstname.lastname@example.org> wrote: > I want my first check to verify email address uniqueness. If this > validation fails, there's no reason to go further with validating the > user's input. I want a singular message displayed in this case. Is > there a way to do this? I think the best way would be to use your own function (instead of error_messages_for) for displaying the error. You might also be able to get somewhere with the :if option to validations (and have your if function check whether there are any errors yet). While the examples you provide are interesting, more generally it is really annoying as a user to have to correct form errors once at a time. Fred
on 2009-02-14 14:16
Thanks for the response. I'm still not sure how I'll approach this. I'm going to spend a bit of time tinkering with the :if option, as well as creating my own validation function. I agree that it is annoying for the user to have to correct errors one at a time. But I'd imagine correcting a series of errors, just to finally realize that the email address has already been registered, might be equally as annoying. Hence why I want the email uniqueness check to be first and foremost. If their email address has been used, the rest of the validation errors become moot. On Feb 14, 5:16 am, Frederick C. <email@example.com>