bcardarella/client_side_validations — pull request #251 by coryschires (2012-01-14 03:58:23+00:00)
Title: Better UI for `attribute confirmation` fields

This pull request provides a better UI for confirmation fields – specifically it now validates `attribute` / `attribute_confirmation` only after tabbing out of the `attribute_confirmation` field. It involves two changes:

1. Don't trigger validation if the `attribute_confirmation` field is blank.
Currently as soon as you focus on the `attribute_confirmation` field, the corresponding `attribute` field registers an error – before the user has even had a chance to type anything. That sorta sucks.

2. Don't validate the `attribute_confirmation` field on keyup.
I'm not sure keyup makes sense here. We don't want the user seeing an error until they are finished typing and have blurred off the field.

Unfortunately, this *does not* fix the issue of the validation registering (at least arguably) on the wrong field. I believe the expected behavior would be for the validation to display on `attribute_confirmation` rather than `attribute`. As @bcardarella pointed out, however, this is how Rails validations work and so this feels like the wrong place to be addressing that issue.

@bcardarella: I've updated the tests as well. Let me know if you'd like me to make any tweaks.