Reputation: 10327
How can I change the default size of textbox for timepicker in Yii. I'm using timepicker in Yii from the link timepicker.
I have tried the htmlOptions , its now working,
$this->widget('application.extensions.timepicker.timepicker',
array(
'model'=>$model,
'name'=>'starttime',
'select'=> 'time',
'options' => array(
'showOn'=>'focus',
'timeFormat'=>'hh:mm:ss',
'htmlOptions' => array(
'size' => '10', // textField size
'maxlength' => '10', // textField maxlength
),
),
)
);
what is the right way to set HTML options to the timepicker.
Upvotes: 0
Views: 1763
Reputation: 364
modify timepicker widget view file.there will be a size property.
<input type="text" class="timepicker" id="<?php echo $this->id; ?>" value="<?php echo $this->model->{$this->name}?$this->model->{$this->name}:$this->options['value']; ?>" name="<?php echo get_class($this->model).'['.$this->name.']'.$this->tabularLevel; ?>" size="15" />
Upvotes: 0
Reputation: 859
I think your htmlOptions
should not be inside the options
array.
I'm using the Yii extension EJuiDateTimePicker (http://www.yiiframework.com/extension/ejuidatetimepicker/) which is based on the same timepicker basically and there I can define the textfield size like this:
$this->widget('ext.timepicker.EJuiDateTimePicker', array(
'model'=>new Report(),
'name'=>'creation_date',
'options' => array(
'showOn'=>'focus',
'timeFormat'=>'hh:mm:ss',
'timeOnly'=>true,
),
'htmlOptions' => array(
'style'=>'width:150px;', // styles to be applied
'maxlength' => '10', // textField maxlength
),
));
Hope this helps...
Upvotes: 1