I know that simple textfield element in yii is formed like this
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'username'); ?>
</div>
now I need to make some radio button type thing in my form to choose between 2 options and send choice later via form.
I've found cool looking Button toolbar
http://bootstrap3.pascal-brewing.de/site/components#btn-groups-toolbar
echo BsHtml::buttonToolbar(array(
array(
'items' => array(
array(
'label' => 'first button'
),
)
),
array(
'items' => array(
array(
'label' => 'second button'
),
)
)
));
which works great in html, but how can I tell these buttons about my $model and my attributes ? Cannot find any explanations about where to put model and other attributes in that code :(
I don't think it allows for that if you want to use them as form elements you would probably have to have a hidden input for the attribute and then do some javascript/jquery to update the value of that hidden input based off of the selected button from the button bar.