Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Form] Unwanted Validation on DateTime Type #7182

Closed
@raphpar

Description

@raphpar

Hi there,

I have notice that for a datetime Type, an automatic validation is done after form submiting.
I splitted my field like this:

$builder->add('matchDate', 'datetime', array(                   
    'required' => false, 
    'invalid_message' => 'Hello',
    'date_format' => 'dd/MM/yyyy', 
    'date_widget' => 'single_text', 
    'time_widget' => 'choice'
))                  

If I put for example "02/35/2013" in my matchDate.date field, I get an error on the matchDate field with "This value is not valid".

I looked in Symfony\Component\Validator\Constraints\Date.php, Symfony\Component\Validator\Constraints\Time.php, Symfony\Component\Validator\Constraints\DateTime.php and anywhere I could find this error message.

On my entity I have no validation constraints set. Did anyone notice the same behavior on this application ?
In fact, it's not a problem that the validation is done, it's more the unposibility to change the error message even in setting the 'invalid_message' option.

Thanks in advance for you help.

By the way, I'm actualy working on 2.2.0BETA1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions