Reputation: 971
I have the following field:
$this->Form->input('vlog_in', array('timeFormat' => '24'));
This is a 'time' field in database, so it formats the input like: 00:00 (hours:minutes).
How can i show the seconds select box, so my user can select it like 00:00:00 (hours:minutes:seconds)?
Upvotes: 2
Views: 1043
Reputation: 29121
Just build out the form, then piece it together in the controller. I know, not as pretty as if there were just a setting for it, but...
// VIEW
echo $this->Form->input('vlog_in_hours', array('type' => 'select',
'options' => array_combine(range(0,23), range(0,23)),
));
echo $this->Form->input('vlog_in_minutes', array('type' => 'select',
'options' => array_combine(range(0,59), range(0,59)),
));
echo $this->Form->input('vlog_in_seconds', array('type' => 'select',
'options' => array_combine(range(0,59), range(0,59)),
));
//CONTROLLER
function whatever() {
//...
$data = $this->request->data['MyModel'];
$time = $data['vlog_in_hours'].':'.$data['vlog_in_minutes'].':'.$data['vlog_in_seconds'];
$this->request->data['MyModel']['vlog_in'] = $time;
//...
$this->MyModel->save($this->request->data);
//...
}
Upvotes: 2