隐藏单选按钮列表的项


Yii : hide items of radioButtonList

在ii中,我有一个包含radioButtonList的表单,如下所示:

<?php echo  $form->radioButtonList($model, 'send_option', array('mobile'=>'Send SMS to Mobile','email'=>'Send an E-mail')); ?>

我对Yii很不熟悉。我想隐藏列表的第二项(即发送电子邮件)。

欢迎提出建议。

提前感谢

您可以通过Yii clientScript删除它。像下面的

Yii::app()->clientScript->registerScript('search', "
    $('#ModelClassName_send_option_1').hide(); 
    //If your model class name is Message (eg) then it should be $('#Message_send_option_1').hide();
    $('label[for='"ModelClassName_send_option_1'"]').hide();
");

或者你可以从数组中删除它。简单的

<?php echo  $form->radioButtonList($model, 'send_option', array('mobile'=>'Send SMS to Mobile',)); ?>