The type option of FormHelper::input() doesn't necessarily translate directly to the HTML type attribute, but rather to the according FormHelper widget/element, and in case of time, this is multiple inputs for the individual time value components.
Use FormHelper::text()
If you need a single <input> element with the type attribute set, then you'll have to create the element directly via FormHelper::text(), where type will map to the HTML attribute, ie
$this->Form->text('callback_time', array(
'type' => 'time',
// ...
));
Of course you'll loose the magic that FormHelper::input() provides, ie error messages, wrappers, etc, you'll have to handle that on your own then.
See also
Use your own (extended) form helper
Another option would be to create your own, extend FormHelper, and either implement your own type, or override FormHelper::_getInput() or FormHelper::dateTime(), to make the built-in time type use the elements that you need. Here's an example doing the former:
app/View/Helper/MyFormHelper.php
App::uses('FormHelper', 'View/Helper');
class MyFormHelper extends FormHelper
{
public function customTime($fieldName, $options = array())
{
$options =
$this->_initInputField($fieldName, $options) + array('type' => 'time');
return $this->Html->useTag(
'input',
$options['name'],
array_diff_key($options, array('name' => null))
);
}
}
That's basically the same as above (see FormHelper::__call(), which is being invoked for FormHelper::text()), ie it creates a simple <input> element with the type attribute set, but keeps the magic that FormHelper::input() provides.
controller
public $helpers = array(
'MyForm',
// ...
);
.ctp view template
$this->MyForm->input('callback_time', array(
'type' => 'customTime',
// ...
));
See also