如何在单击时隐藏数据组合框下拉列表

时间:2017-03-30 02:14:49

标签: javascript php html combobox

我有一个由一些文本字段和组合框组成的表单。我有一个包含数据教室的组合框,我从数据库中获取的组合框中的数据。问题=如果组合框中的数据1在klic中则数据1将被隐藏。当它想要进一步数据馈送时,数据1保持隐藏状态。但隐藏的数据1由到期日期确定

FORM ADD CLASSROOM

<div class="row">
        <div class="col-md-8">
            <div class="panel panel-default">
                <div class="panel-heading"><svg class="glyph stroked email"><use xlink:href=""></use></svg>Add Training Form</div>
                <div class="panel-body">
                    <form action="add.php" method="POST" enctype="multipart/form-data">
                        <fieldset>

                            <!-- Training Name -->

                            <div class="form-group">
                                <label class="col-md-3 control-label" for="name">Training Name</label>
                                <div class="col-md-9">
                                <input id="name" name="name" required="required" type="text" placeholder="Tulis Nama Training" class="form-control">
                                </div>
                            </div>
                            <br><br>

                            <!-- Class Room -->
                                                <div class="form-group">
                                                    <label class="col-md-3 control-label" for="name">Class Room</label>
                                                    <div class="col-md-9">
                                                        <select name="room" class="form-control input-sm" value=" ">
                                                            <option value="-1" selected="selected" disabled="disabled" >-Ruang Kelas-</option>
                                                            <?php
                                                            include 'admin/connection.php';
                                                                // query untuk menampilkan semua Classroom dari tabel 
                                                                $query = "SELECT * FROM classroom";
                                                                $hasil = mysql_query($query);
                                                                while ($data = mysql_fetch_array($hasil))
                                                                {
                                                                    echo "<option value='".$data['nama']."'>".$data['nama']."</option>";
                                                                }
                                                            ?>
                                                            <option value="Other">Other</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <br><br>

                                                <!-- Instructor -->
                                                <div class="form-group" onsubmit="return validasicombobox">
                                                    <label class="col-md-3 control-label" for="name">Instructor</label>
                                                    <div class="col-md-9">
                                                        <select id="instruc" name="instructor" class="form-control input-sm" value=" ">
                                                            <option value="-1" selected="selected" disabled="disabled" >-Instructor-</option>
                                                            <?php
                                                            include 'admin/connection.php';
                                                                // query untuk menampilkan semua Classroom dari tabel 
                                                                $query = "SELECT * FROM instruk";
                                                                $hasil = mysql_query($query);
                                                                while ($data = mysql_fetch_array($hasil))
                                                                {
                                                                    echo "<option value='".$data['nama']."'>".$data['nama']."</option>";
                                                                }

                                                            ?>
                                                            <option value="Other">Other</option>
                                                        </select>
                                                    </div>
                                                </div>
                                                <br><br>

                            <!-- Time -->
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="name">Time</label>
                                <div class="col-md-9">
                                <input id="time" name="time" type="text" required="required" placeholder="Tulis Waktu Training" class="form-control">
                                </div>
                            </div>
                            <br><br>

                            <!-- Start Date -->
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="name">Start Date</label>
                                <div class="col-md-9">
                                <input id="start_date" name="start_date" required="required" type="date" class="form-control">
                                </div>
                            </div>
                            <br><br>

                            <!-- End Date -->
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="name">End Date</label>
                                <div class="col-md-9">
                                <input id="end_date" name="end_date" required="required" type="date" class="form-control">
                                </div>
                            </div>
                            <br><br>

                            <!-- Type -->
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="name">Type</label>
                                <div class="col-md-9">
                                    <select name="type" class="form-control input-sm">
                                        <option value="-1" selected="selected" disabled="disabled" >-Tipe Training-</option>
                                        <option value="Basic">Basic</option>
                                        <option value="Type">Type</option>
                                    </select>
                                </div>
                            </div>
                            <br><br>

                            <!-- Remark -->
                            <div class="form-group">
                                <label class="col-md-3 control-label" for="name">Remark</label>
                                <div class="col-md-9">
                                    <textarea name="remark" class="form-control" rows="3"></textarea>
                                </div>
                            </div>
                            <br><br>


                            <!-- Form actions -->
                            <div class="form-group">
                                <div class="col-md-12 widget-right">
                                    <button type="submit" value="submit" name ="submit" class="btn btn-default btn-md pull-right" onclick="return confirm('Are you sure want to add this data?');">Submit</button>
                                </div>
                            </div>
                        </fieldset>
                    </form>
                </div>
            </div>
</div>  <!--/.main-->

0 个答案:

没有答案