re1nald0
(Reinld17)
December 11, 2014, 2:54pm
1
What is the best way to adjust the width of input field (textfied, dropdown, etc.)? Until now I can only do:
$form->field($model, 'first_name', [
'template'=>'<div class="row"><div class="col-lg-4">{label}{input}{error}</div></div>'
])->textInput()
which looks cumbersome, especially when there are a lot of fields in the form. If we tried to set the style:
$form->field($model, 'first_name')->textInput(['style'=>'width: 30%'])
will the responsive functionality lost? I wonder if there is a way to set it like Yii 1.1:
$form->textField($model, 'name', array('size'=>60))
samdark
(Alexander Makarov)
December 11, 2014, 4:19pm
2
You can still set size via third argument but in order to stay responsive you need to follow what bootstrap proposes.
re1nald0
(Reinld17)
December 12, 2014, 2:02am
3
I have tried it before:
$form->field($model, 'first_name')->textInput(['size'=>5])
and it didn’t change the width of textfield (like mentioned in this issue). Is there a more efficient way to adjust field width than setting template property?
samdark
(Alexander Makarov)
December 12, 2014, 9:49am
4
No if you’re using bootstrap css.
re1nald0
(Reinld17)
December 12, 2014, 12:22pm
5
Thanks for clarifying it. +1