weixin_33698823 2019-12-04 02:31 采纳率: 0%
浏览 67

HTML自定义按钮

I am having challenges to hide specific buttons when a record in MyDql Db is set to 'missed'. Please help, here is my code:

Database Connexion

$sql = "SELECT * FROM appointment";
$req = $bdd->prepare($sql);
$req->execute();
$events = $req->fetchAll(); 

HTML

Calendar API Downloaded from http://jamelbaz.com/tutos/integration-de-fullcalendar2-php-mysql

<div id="calendar" class="col-centered"> </div> 
<input type="text" name="title" class="form-control" id="title" placeholder="Name" >
<input type="text" name="surname" class="form-control" id="surname" placeholder="Surname">
<input type="submit" class="" id="Save" name="1" value="Save changes">
<input type="submit" id="try1" class="button alt" name="2" value="Arrived">
<input type="submit" id="try2" class="button alt" name="3" value="Did not arrived"> //once clicked hide Arrived button
<input type="submit" id="try3 class="button alt" name="3" value="Send email"> //show only if record is set to missed

Backend

eventRender: function(event, element) {
element.bind('click', function() {
$('#ModalEdit #name').val(event.name);
$('#ModalEdit #surname.val(event.surname);
},
events: [
<?php
foreach($events as $event): 
?>
title: '<?php echo $event['name'] ?>',
surname: '<?php echo $event['surname']; ?>',
<?php  endforeach;?>
]
});

enter image description here

  • 写回答

1条回答 默认 最新

  • weixin_33698043 2019-12-04 02:55
    关注

    Assuming your current ajax based approach is working, Use $('#your_button_id').prop("disabled", true); inside your foreach loop. Since this has many buttons, you need to have different button ids for each button to identify separately. you can use a row id or similar id with a name prefix for button ids.

    eventRender: function(event, element) {
    element.bind('click', function() {
    $('#ModalEdit #name').val(event.name);
    $('#ModalEdit #surname.val(event.surname);
    },
    events: [
    <?php
    foreach($events as $event): 
       if($event['status']=='missed') {
    ?>
          $('#your_button_id_or_class').prop("disabled", true);
    <?php
       }
    ?>
    title: '<?php echo $event['name']; ?>',
    surname: '<?php echo $event['surname']; ?>',
    <?php  endforeach;?>
    ]
    });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题