简体   繁体   English

如何根据表单中单选按钮的选择显示/隐藏div标签

[英]How to show/hide div tags based on the selection of a radiobutton in a form

I'm using two radiobuttons('reviewed' and 'not reviewed') in search box to filter the values in admin.php. 我在搜索框中使用了两个单选按钮(“已审阅”和“未审阅”)来过滤admin.php中的值。 There are another two buttons('approved' and 'rejected') in search box which has to be displayed when 'reviewed' is clicked and hidden when 'not reviewed' is clicked. 搜索框中还有另外两个按钮(“已批准”和“已拒绝”),这些按钮必须在单击'reviewed'时显示,而在单击'not reviewed'时隐藏。
Below is the code of the search form. 以下是搜索表单的代码。

<div class="row">
        <?php #echo $form->label($model,'ReviewedDate'); ?>     
                <?php echo $form->radioButtonList($model, 'ReviewedDate', 
        array('1' => 'Reviewed', '' => 'Not Reviewed')
    ); ?>
    </div>

       <div class="row"> 
                <?php echo $form->radioButtonList($model, 'Approved', 
        array('0' => 'Rejected', '1' => 'Approved')
    ); ?> 
    </div>
<div class="row buttons">
        <?php echo CHtml::submitButton('Search'); ?>
    </div>

How can I display the second div based on the review/not reviewed button of first . 如何基于first的评论/未评论按钮显示第二个div。 within the search form. 在搜索表单中。

您将需要使用Javascript,查看代码所生成的HTML,然后将单选按钮与合适的Javascript函数挂钩,以显示或显示其他元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM