dousheyan0375
dousheyan0375
2015-02-25 05:12

选择框验证

  • php

below is the code for selectbox validation but it is not working..can anybody help please..

        <?php include('../config.php'); ?>

            <style>
        #errorMessage {
          color:red;
            font-size:12px;
              margin-left:10px;
             }
          </style>


       </form>
          <script src="http://code.jquery.com/jquery-1.11.1.min.js">                     </script>
         <script src="http://jqueryvalidation.org/files/dist/jquery.validate.min.js"></script>
              <script src="http://jqueryvalidation.org/files/dist/additional-methods.min.js">             </script>
           <script>

         jQuery.validator.setDefaults({
         debug: true,
           success: "valid"
              });
                $( "#agentlist" ).validate({
          rules: {
           field: {
           required: true
        }
         }
           });
         </script>
        <div id="distanceform" style="width:100%; height:auto;border:0.1em solid #CCC;float:left;">
       <div id="distanceformtitle" style="border-bottom:0.1em solid #CCC;width:98%;height:25px;text-align:left;font-size:13px;padding-left:2%;padding-top:11px;background-color:#FAFAFA;color:#1D89CE;">Distance Report</div>
          <div id="errorMessage"></div>
    <span>

      <select name="agentlist" id="agentlist" class="selectclass">
      <option value="">--Select Agent--</option>
       <?php
               $x=mysqli_query($con,"select * from accounts where gid='0' and companyid='".$_SESSION['newforcecid']."' and publishstatus='1'");
            while($data=mysqli_fetch_assoc($x)){
              ?>     
           <option value="<?php echo($data['imeino']); ?>">
          <?php      echo($data['firstname']); ?></option><?php
       }
         ?>
     </select>

        </span>
         <span><input type="text" class="textclass" name="fromdate" id="fromdate" placeholder="From Date" value="<?php echo(date('d-m-Y')); ?>"></span>
       <span><input type="text" class="textclass" name="todate" id="todate" placeholder="To Date" value="<?php echo(date('d-m-Y')); ?>"></span>
        <input type="button" id="search" name="search"  value="Search" class="btnclass">

        </div>
        <br>
         <div id="distanceresult"  >
        </div>

validation is not working..when i click on submit data is not gettng displayed and at same time error msg is also not gettng displayed

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答