0

how to make jq-ui datepicker working beside jquery validation engine?

at first, my datepicker was working before I put the validator. now the validator is working but the datepicker is not.

//datepciker
   $(function() {   
      $( "#datepicker" ).datepicker({ changeYear:true,changeMonth:true });
   });


//jqueryValidation
        $(document).ready(function(){
          $("#form").validationEngine();
        });



    <fieldset>
    <form  id="form" method="post" action="post.php">
        <table>
            <tr>
                <td>NIP*</td>
                <td><input class="validate[required,custom[onlyNumberSp]"
                id="nip" maxlength="18" name="nip" size="20" type="text"></td>
            </tr>
            <tr>
                <td>TMT*</td>
                <td><input id="datepicker" name="tmt" type="text"></td>
            </tr>
        </table>
    </form>
</fieldset>
0

1 Answer 1

1

Check the code below and make sure you have all js and css files loaded properly. Also it appeared you were missing a right bracket "]" in your validated input class, though it actually didn't appear to make a difference.

This code ran perfectly fine on my server.

<!doctype html>
<html lang="en">
<head>
   <meta charset="UTF-8">

   <title>Validate</title>

   <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
   <link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" />

   <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
   <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
   <script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
   <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>

   <fieldset>
      <form  id="form" method="post" action="post.php">
         <table>
            <tr>
               <td>NIP*</td>
               <td>
                  <input class="validate[required,custom[onlyNumberSp]]" id="nip" maxlength="18" name="nip" size="20" type="text"/>
               </td>
           </tr>
           <tr>
              <td>TMT*</td>
              <td>
                 <input id="datepicker" name="tmt" type="text"/>
              </td>
           </tr>
      </table>
   </form>
</fieldset>

<script type="text/javascript">
   //datepicker
   $(function() {   
      $( "#datepicker" ).datepicker({ changeYear:true,changeMonth:true });
   });


   //jqueryValidation
   $(document).ready(function(){
      $("#form").validationEngine();
   });
</script>

</body>
</html>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.