Reputation: 2305
I am trying to make the text box of jui DatePicker in Yii2 look more like the other text boxes, by adding 'form-control' to the class name of the input control, when rendered.
I tried using clientOptions like this...
'clientOptions' => [ 'class' => 'form-control' ]
'clientOptions' => [ 'className' => 'form-control' ]
...and also as widget options, but am unable to figure this out.
Compared to Bootstrap Datetimepicker, the jui one looks really ugly.
Any ideas how I can add a class or make it look like other textboxes?
I have a simple datepicker, no fancy formattings, but am using it in my model.
Upvotes: 10
Views: 10878
Reputation: 189
I came across the same problem but
'options' => ['class' => 'form-control']
did not work for me. I resulted to using the CHtml
argument called $htmlOptions
which is basically an array that holds the attributes of the HTML element and it worked for me.
'htmlOptions'=>array('class'=>'form-control')
Upvotes: 0
Reputation: 294
It may be given like this.
<?= $form->field($model, 'client_name')->widget(
\yii\jui\AutoComplete::classname(),
[
'options' => ['class' => 'form-control'],
'clientOptions' => [
'source' => ['USA', 'RUS'],
],
]
)?>
Upvotes: 0
Reputation: 2305
Figured it out. It was simply...
'options' => ['class' => 'form-control']
Upvotes: 25