2017-06-11 2 views
0

das problem ist, wenn ich die erste eingabe füllen die zweite eingabe highlight mit grün und wenn die erste eingabe löschen die zweite eingabe highlight mit reed ich versuche viele lösung mit diesem skript aber ich verstehe nicht, was ist das Problemprobleme mit bootstrap validator

<form id="contactForm" method="post" class="form-horizontal"> 

    <fieldset> 
    <legend align="">Information Personnel</legend> 
    <div class="form-group"> 
      <div class="col-sm-5"> 
       <label>Prénom</label> 
       <input type="text" name="1" class="form-control" placeholder="Prénom"> 
      </div> 
      <div class="col-sm-5"> 
       <label style="display:block; text-align: right;">الإسم</label> 
       <input type="text" name="2" class="form-control keyboardInput" placeholder="الإسم" style="text-align: right;"> 
      </div> 
    </div> 

     <div class="form-group"> 
     <div class="col-md-9 col-md-offset-3"> 
      <button type="submit" class="btn btn-default">Validate</button> 
     </div> 
    </div> 
    </fieldset> 
</form> 

und dies das Java-Script

$(document).ready(function() { 

    $('#contactForm').bootstrapValidator({ 
     //container: '#messages', 
     feedbackIcons: { 
      valid: 'glyphicon glyphicon-ok', 
      invalid: 'glyphicon glyphicon-remove', 
      validating: 'glyphicon glyphicon-refresh' 
     }, 
     fields: { 
      1: { 
       validators: { 
        notEmpty: { 
         message: 'Veuillez remplir votre nom' 
        } 
       } 
      }, 
      2: { 
       validators: { 
        notEmpty: { 
         message: 'Veuillez remplir votre hhhh' 
        } 
       } 
      } 
     } 
    }); 
}); 

Antwort

0

Ihre Felder ein

durch eine in einer Form Gruppe setzen
<div class="form-group"> 
      <div class="col-sm-5"> 
       <label>Prénom</label> 
       <input type="text" name="1" class="form-control" placeholder="Prénom"> 
      </div> 
</div> 
<div class="form-group"> 
      <div class="col-sm-5"> 
       <label style="display:block; text-align: right;">الإسم</label> 
       <input type="text" name="2" class="form-control keyboardInput" placeholder="الإسم" style="text-align: right;"> 
      </div> 
    </div> 
Verwandte Themen