If layout
is set to horizontal
a horizontal form is rendered.
$form = $this->beginWidget('Codemix\BS3ActiveForm', array( 'layout' => 'horizontal', ));
Here the standard template is set to {label} {beginWrapper} {input} {error} {endWrapper} {help}
,
which will use 3 columns for label (col-sm-3
), input (col-sm-6
)
and help text (col-sm-3
). Error messages get rendered below the input. The column
arrangement can easily be changed, though (see below).
Following is a list of the most common form elements to exemplify different options and validation states.
$form = $this->beginWidget('Codemix\BS3ActiveForm', array( 'layout' => 'horizontal', 'template' => "{label}\n{beginWrapper}\n{input}\n{help}\n{error}\n{endWrapper}", 'horizontalLabelClass' => 'col-sm-4', 'horizontalWrapperOffsetClass' => 'col-sm-offset-4', 'horizontalWrapperClass' => 'col-sm-8', 'horizontalErrorClass' => '', 'horizontalHelpClass' => '', ));