dongshou6041 2017-05-02 02:11
浏览 195

如何自动选中和取消选中复选框

I'm doing a page where i can display a list of data with checkboxes. then i will automatically check with database and if the data is there, the checkbox will be checked. What i want to do now is, lets say the checkbox is checked automatically, andwhen i unchecked it myself and save, it will update the data in database.

Example of my coding:

<form action="{{URL::to('/granted/'.$d->id)}}" method="get">
    <input name="_token" type="hidden" value="{{ csrf_token() }}"/>
    @foreach($var as $v)
    <table style="margin-left:20px;">
         <caption>{{$v->module_groupname}}</caption>
         @foreach($name as $n)
         <?php if($n->module_groupname == $v->module_groupname){?>
         <tr><td width="80"><input type="checkbox" name="module_code[]" value="{{ $n->module_code }}"
         <?php foreach($priv as $p){
         if($p->user_id == $d->id){
             if($p->module_code == $n->module_code){
                 echo 'checked="checked"';
             }
         }
     }?>></td>
     <td width="150">{{$n->module_groupname}}</td>
     <td width="200">{{ $n->module_desc}}</td>
    </tr> <?php } ?>
 @endforeach
</table>
<hr>
@endforeach
<input type="submit" value="select" class="btn btn-s btn-success">
</form>

i've been advised to lookup for PLUS statement oracle but i couldnt find how

  • 写回答

3条回答 默认 最新

  • dsm42026 2017-05-02 05:31
    关注

    for automatically checked you need set Attribute checked for that checkbox

    https://www.w3schools.com/tags/att_input_checked.asp

    for doing this by js you follow this url ! say setAttribute property

    https://www.w3schools.com/jsref/met_element_setattribute.asp

    hope this will help you

    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大