Closed nbogol closed 9 years ago
Some questions (thanks for the PR though)... as this PR may break the layout for some scenarios
<div class="row">
, it may break the layout.IMO... the PR can be simplified to just one option to capture the input container and its HTML attributes.
Kartik, I did some more testing and code inspection: My code is in effect only when '$form->hasInputCss()' is true. And, if you do not explicitly set formConfig.labelSpan, it is true only for HORIZONTAL type of the form and my code is executed and works just fine. But if you set formConfig.labelSpan, it will be executed for INLINE and VERTICAL. I think formConfig.labelSpan should be disabled for INLINE and VERTICAL form types, because it does not make sense and does not work correctly anyway. (try to set formConfig.labelSpan=2 for VERTICAL form - it will render as horizontal)
Kartik, do you have any comments on my response or you do not want to do this. Please let me know. I will remove my pull request then.
Not yet checked on this yet. But on initial thoughts since this is only for horizontal forms - the inputSpan is automatically derived based on labelSpan for horizontal forms. Is there a reason why you do not want to provide labelSpan?
For VERTICAL form type labelSpan is irrelevant, right? :
Name [ ]
Yes my query was more for horizontal forms - where input span is derived automatically based on label span. Do you wish to override the input span with this use case? Once you confirm will check a bit on this later to see.
I think the use case for where this is useful is for HORIZONTAL forms when you wish to hide the label. Right? Will check and incorporate this.
Ok enhancements have been done and you have two options:
contentBeforeInput
and contentAfterInput
, you can configure that along with showLabels
to false to set fields side by side for example:// Address and city side by side for horizontal
echo $form->field($model, 'address', [
'contentBeforeInput' => '<div class="row"><div class="col-sm-6">',
'contentAfterInput' => '</div><div class="col-sm-6">' .
$form->field($model, 'city')->label(false) . '</div></div>'
]);
Enhancement. Add 'inputSpan' integer option to the kartik\form\ActiveField. If set, this option will result 'col--' class set for input div wrapper.