문제

In my form I want to have the time in 24h mode. In datetime specification in the cookbook there is a parameter timeFormat that accepts 12, 24 or null values but when I try to add it inside the parameters of the form input it doesn't work. Still I have the 12h mode with am/pm select. The dateFormat works OK.

My view is:

echo $this->Form->input('Reservation.arrival', array(
            'label'=>'Check IN', 
            'div'=>'clear IconDate',
            'timeFormat ' => '24',//doesn't work
            'dateFormat' => 'DMY',
            'minYear' => date('Y') - 0,
            'maxYear' => date('Y') + 1 ,
            )
        );

I am using CakePHP 1.3.

Thanks!

도움이 되었습니까?

해결책

You have a space in your key 'timeFormat '. Make sure you remove the trailing space at the end, and it should work just fine. :)

Before:

'timeFormat ' => '24'

After:

'timeFormat' => '24'

다른 팁

 $this->Form->input('tob',array('selected'=>'06:35:00','label'=>'Time Of birth','type'=>'time','timeFormat'=>'24' )); 

This way selected value can be set. 'selected' attribute is there so set default time in select boxes

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top