APY/APYJsFormValidationBundle — pull request #2 by guillaumepotier (2011-11-29 20:50:30+00:00)
Title: Added ReapeatedValidation + tweaked CacheWarmer

Hi, I had a nice time with your bundle today ;)

I faced a tricky problem today with the js validation of a repeated password field. Neither the first password nor the second password (confirmation) had validation cause once repeated the fields took a different name:

`user_password` becomes `user_password_first` and `user_password_second` by default or event different if you give special names like:

$builder->add('password', 'repeated', array(
'type' => 'password',
'invalid_message' => 'The password fields must match..',
'first_name' => 'password',
'second_name' => 'password_confirm',
));`

I added a `RepeatedValidator.js.twig` to check if second password equals the first one.

I had also to rework a bit on your code. You used to foreach the constraints and check if they were in fields Asserts, I did the other way, by doing a foreach on fields and checking then their constraints.

My *unsolved* problem with this PR is that I was not able to get the `invalid_message` for this repeated constraint.. It is currently hard coded in english in the CacheWarmer... If you have a better idea to enhance that ;)

Best