Reputation: 393
Why is my Zend DateTime element not working?
View:
echo $this->formDateTime($form->get('initial_call_time'));
Form Class:
$this->add(array(
'name' => 'initial_call_time',
'type' => 'Zend\Form\Element\DateTime',
'options' => array(
'label' => 'Call Date Time',
),
'attributes' => array(
'min' => '2010-01-01T00:00:00Z',
'max' => '2020-01-01T00:00:00Z',
'step' => '1', // minutes; default step interval is 1 mint
) ));
Controller
$dateTimeLocal = new Element\DateTimeLocal('initial_call_time');
$dateTimeLocal
->setLabel('Appointment Date')
->setAttributes(array(
'min' => '2010-01-01T00:00:00',
'max' => '2020-01-01T00:00:00',
'step' => '1', // minutes; default step interval is 1 min
))
->setOptions(array(
'format' => 'Y-m-d\TH:i'
));
$form = new InitialCallForm;
$form->add($dateTimeLocal);
Is there a good tutorial on this anywhere? I tried to follow the instructions on the website but it does not seem to work. Currently I get a blank form box.
Upvotes: 1
Views: 368
Reputation: 1571
Many browsers don't support the HTML element generated by this helper. Hence to answer your question you are likely testing on a non supported browser:
http://caniuse.com/#feat=input-datetime
Upvotes: 2