Set the "invalid_message" option on your actual field in your form.

See, the error is not being thrown by your validation, but rather by the
"date" type field itself. The form validation layer is responsible for
saying "does this data make sense" (e.g. did they enter "apple" for a date
field). The true validation that you configure is responsible for saying
"is this date in the valid range that I need in my application".

It's subtle, but I hope that helps :).

Thanks!

Ryan Weaver
US Office Head & Trainer - KnpLabs - Nashville, TN
http://www.knplabs.com <http://www.knplabs.com/en>
http://www.thatsquality.com
Twitter: @weaverryan


On Wed, Nov 9, 2011 at 2:29 PM, Adam <adam.sowin...@gmail.com> wrote:

> I don't know if it is a bug but I try to show a user a custom message
> with this code in validation.yml:
>
> birthday:
>    - Date: { message: a custom message }
>
> But instead I get: This value is not valid.
>
> I can setup a custom message in NotBlank constraint - no problem, but
> not in Date. I use Symfony 2.0.5.
>
> Any ideas?
>
> Adam
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to symfony-devs@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-devs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to