简体   繁体   中英

JQuery validation engine not working, not displaying error messages

i have a simple form where im trying to use the jquery.validationEngine to make it look better and display error messages when user is not typing the correct requested things, i did what i was supposed to make it work according to de documentation, im testing it on the first input with a simple validate[required] attribute, i dont understand why is not working.

code of the form:

<form class="col-md-5 col-md-offset-3" id="FormularioAlta" method="post" style="padding:7px" onsubmit="return submitForm()">
  <fieldset>
    <legend>Alta Como Simpatizante</legend>


      <label for="idcel">Celular</label><br />
      <div class="input-group add-on">
      <input class="form-control validation[required]"  id="idcel" name="cel" >
       <div class="input-group-btn">
        <button  class="btn btn-default" type="button" title="Ayuda"  
      data-container="body" data-toggle="popover" data-placement="bottom"  data-trigger="hover" 
      data-content="El numero consta de 10 digitos, 3 de la clave lada(614 por ejemplo) mas los otros 7 numeros. Ejemplo: 6149987781" ><i class="glyphicon glyphicon-question-sign"></i></button>
      </div></div>





      <label for="idcelconfirmacion">Confirma tu Celular</label><br />
      <input class="form-control" id="idcelconfirmacion" name="celconfirmacion" minlength="10"  maxlength="10"  type="number"  equalTo="#idcel" required>
       <br />



      <label for="idocr">OCR</label><br />
          <div class="input-group add-on">
      <input class="form-control" id="idocr" minlength="9"  maxlength="13"  type="number" name="ocr"  required>
     <div class="input-group-btn">
        <button class="btn btn-default" type="button" title="Ayuda"  
      data-container="body" data-toggle="popover" data-placement="bottom"  data-trigger="hover"
     data-img="http://www.subeimagenes.com/img/ocr-1213155.png"><i class="glyphicon glyphicon-question-sign"></i></button>
      </div></div>


       <br />
      <label for="idocrconfirmacion">Confirma tu OCR </label><br />
      <input class="form-control" id="idocrconfirmacion" minlength="9"  maxlength="13"  name="ocrconfirmacion" type="number" equalTo="#idocr" required>

    <br />
      <input class="btn btn-default" type="submit" value="Enviar">

  </fieldset>
</form>

ignore the attributes on the other input fields, i had it working with the jquery.validation plugin but im trying to switch it to the engine cause i think it looks better and doesnt mess much with the bootstrap elements around.

here is where i instantantie the plugin with the form:

 <script>


$(document).ready(function(){
    $("#FormularioAlta").validationEngine();
});

</script>

and yes, of course i included this on the page:

 <script src="~/Scripts/jquery.validationEngine.js"></script>
        <script src="~/Scripts/jquery.validationEngine-en.js"></script>
 <link href="~/Content/css/validationEngine.jquery.css" rel="stylesheet" />

any ideas why is not working?

ok, i solved, it seems that on the documentation there are to ways to use the engine on the input.

i was using the first one that is:

 <label for="idcel">Celular</label><br />
      <div class="input-group add-on">
      <input ***class="form-control validation[required]"***  id="idcel" name="cel" >
       <div class="input-group-btn">
        <button  class="btn btn-default" type="button" title="Ayuda"  
      data-container="body" data-toggle="popover" data-placement="bottom"  data-trigger="hover" 
      data-content="El numero consta de 10 digitos, 3 de la clave lada(614 por ejemplo) mas los otros 7 numeros. Ejemplo: 6149987781" ><i class="glyphicon glyphicon-question-sign"></i></button>
      </div></div>

so i changed the input line for:

**<input class="form-control" data-validation-engine="validate[required, minSize[10], maxSize[10]]"  id="idcel" name="cel" >**

and it worked

hope this helps other people on the future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM