I have the following situation:
- form field type
date - validation pattern e.g.
dd.mm.YYYY - auxiliary object, which turns
12 into 12.07.2012 or 2.5 into 02.05.2012 , etc.
My question is: where can I call a method that converts the input value?
When I call it from the set method of the object, the value actually changes. But when you reload the form (for example, incomplete submission), the old value (for example, 2.5 ) is displayed, and not the converted value ( 2.5.2012 ). Now, how do you tell the form that the value has changed inside the object?
Maybe there is another way to do this between:
$form->bindRequest($request); // do some fancy stuff here if ($form->isValid()) {}
Php
This is from an object:
protected $date_start;
This is of type:
$builder->add('date_start', 'datetime', array( 'label' => 'Start Datum/Uhrzeit', 'date_widget' => 'single_text', 'time_widget' => 'single_text', 'date_format' => 'dd.MM.yyyy', 'with_seconds' => false, 'required' => false, ));
source share