I have a Symfony 2.0 app.
It has a datetime field on an entity, and a datetime field on a form.
How can I have the date part of that form render with a jQuery UI date picker instead of the 3 select boxes?
Thanks,
EDIT
This is what I have so far:
$builder->add('start_at', 'datetime',array('date_widget' => 'single_text'));
This puts a text box on the page for the date then 2 select boxes for the time, and you can easily add a jQuery UI on top of that!
The problem is the Symfony datetime field only accepts input in the format "Aug 29, 2012". If the user types in "Aug 29 2012" or "29 Aug 2012" it refuses to validate.
So anyone who can fix that problem or suggest an entirely different working approach would be much appreciated.
Take a look at this bundle. It provides several extra form types, including a jquery date form field:
https://github.com/genemu/GenemuFormBundle
I ended up using this code
$builder->add('start_at', 'datetime' ,array(
'date_widget'=> 'single_text',
'date_format'=>'d/M/y',
....
));
then putting jQuery UI on top of it, and just dealing with the fact that it only accepts input in one format only.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With