Wednesday, 15 April 2015

php - Yii CHtml::radioButton ----adding labels -



php - Yii CHtml::radioButton ----adding labels -

i have code i'm using chtml::radiobutton, want add together labels inline after each button.

i tried radiobuttonlist, got labels working, not default 'no' checked.

i want reveal text-field upon 'yes' button beingness checked.

<tr id="multi_part_view" style="display:none"> <th><?php echo chtml::encode($model->getattributelabel('multi_part_po#')); ?></th> <td> <?php echo chtml::activetextfield($model,'multi_part_view',array('size'=>120,'maxlength'=>64,'value'=>$model->multi_part_view)); ?> </td> </tr> <tr> <th><?php echo chtml::encode($model->getattributelabel('multi_part_po#')); ?></th> <td> <?php echo chtml::radiobutton( 'multi_part_po', true, array('value'=>'no', 'uncheckvalue' => null), array('onclick' => "$('#multi_part_view').show();") )?> <?php echo chtml::radiobutton( 'multi_part_po', false, array('value'=>'yes','uncheckvalue'=>null) ); ?> </td> </tr>

if want render label after each input can utilize approach:

<?php echo chtml::radiobutton('multi_part_po', false, array('value'=>'yes', 'id'=>'radiobuttonid', 'uncheckvalue'=>null)); ?> <?php echo chtml::label(chtml::encode($model->getattributelabel('multi_part_po')), 'radiobuttonid', ); ?>

also can wrap radio button in <label>...</label> follows:

<?php echo chtml::opentag('label'); echo chtml::radiobutton('multi_part_po',false, array('value'=>'yes', 'id'=>'radiobuttonid', 'uncheckvalue'=>null)); echo chtml::encode($model->getattributelabel('multi_part_po')); echo chtml::closetag('label'); ?>

php jquery yii radio-button

No comments:

Post a Comment