show new form after checked

    0

    1

    Dani Purnama

    <div class="form-group">
                                                                            <label for="">Peralatan Penunjang</label><br>
                                                                            <div class="row">
                                                                                <div class="col-md-6">
                                                                                    <?php
                                                                                    $i = 1;
                                                                                    $data_peralatan_penunjang = explode(";", $peralatan_penunjang);
                                                                                    $list = array("ESU/Cauter", "Suction");
                                                                                    foreach ($list as $row) {
                                                                                        if (in_array($row, $data_peralatan_penunjang)) {
                                                                                            $checked = "checked";
                                                                                        } else {
                                                                                            $checked = '';
                                                                                        }
                                                                                        echo '<input type="checkbox" ' . $checked . ' name="peralatan_penunjang[]" id="peralatan_penunjang' . $i++ . '" value="' . $row . '"> ' . $row . ' <br>';
                                                                                    }
                                                                                    ?>
                                                                                </div>
                                                                                <div class="col-md-6">
                                                                                    <?php
                                                                                    $i = 3;
                                                                                    $data_peralatan_penunjang = explode(";", $peralatan_penunjang);
                                                                                    $list = array("Laparoskopi", "Lain-Lain");
                                                                                    foreach ($list as $row) {
                                                                                        if (in_array($row, $data_peralatan_penunjang)) {
                                                                                            $checked = "checked";
                                                                                        } else {
                                                                                            $checked = '';
                                                                                        }
                                                                                        echo '<input type="checkbox" ' . $checked . ' name="peralatan_penunjang[]" id="peralatan_penunjang' . $i++ . '" value="' . $row . '" onclick="penunjang_lain(this.id)"> ' . $row . ' <br>';
                                                                                    }
                                                                                    ?>
                                                                                </div>
                                                                            </div>
                                                                        </div>
                                                                        <div class="form-group" id="peralatan_penunjang4_lain" style="display: none;">
                                                                            <label for="">Pelatan Penunjang Lain</label>
                                                                            <input type="text" name="peralatan_penunjang_lain" id="peralatan_penunjang_lain" class="form-control" value="<?php echo $peralatan_penunjang_lain; ?>">
                                                                        </div>
    
    
    var peralatan_penunjang_lain = $('#peralatan_penunjang_lain').val();
            if (peralatan_penunjang_lain != '') {
                $("#peralatan_penunjang4_lain").fadeIn();
            }
    
    function penunjang_lain(id) {
        var checkBox = document.getElementById(id);
        var text = document.getElementById(id + "_lain");
        if (text != null) {
        if (checkBox.checked == true) {
          text.style.display = "block";
        } else {
          text.style.display = "none";
        }
        }
      }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.