javascript - jQuery: validation message position for chzn-select -


in form of web application message error validation showed under select menu (in particular chzn-select plugin menu). can see screenshot: enter image description here

it works "metodo pagamento" select while not work "cliente" select , because, think, cliente chzn-select menu. boss wants me move message under select. here code php-html page generation file:

<style>   label[for="oggetto[]"] {  padding: 76px 0px 0px 143px !important;  }   label[for="modalita_pagamento"] {    padding: 13px 0px 0px 130px !important;  }   div.selector {  overflow: visible;  }   #filed-sel {  padding: 19px !important;  }  </style>  ...  <p>   <label>cliente</label>   <span class="field" id="filed-sel">      <?php         if (isset($progetto['id_cliente']))           $sistema->clienti->selectmenuclienti($progetto['id_cliente']);         else           $sistema->clienti->selectmenuclienti(null);      ?>   </span> </p>  ...  <p>   <label>metodo pagamento</label>   <span class="field" id="filed-sel">      <?php         if (isset($progetto['metodo_pagamento']))         $sistema->progetti>setpagamentometodo($progetto['metodo_pagamento']);         else         $sistema->progetti->setpagamentometodo(null);     ?>   </span> </p>   ...  public function selectmenuclienti($id_cli) {     $list_cli = $this->allclienti("");     echo '<select data-placeholder="scegli un cliente..." id="client_prj"  name="client_prj" class="chzn-select">';     echo '<option value=""></option>';      for($i=0; $i<count($list_cli); $i++) {         if (($id_cli != null) && ($id_cli == $list_cli[$i]["id"])) {             echo '<option value="'.$list_cli[$i]["id"].'"  selected>'.$list_cli[$i]["id"].' - '.$list_cli[$i]["cognome"].' '.$list_cli[$i]["nome"].'</option>';         }         else {echo '<option value="'.$list_cli[$i]["id"].'">'.$list_cli[$i]["id"].' - '.$list_cli[$i]["cognome"].' '.$list_cli[$i]["nome"].'</option>';         }     }      echo '</select>'; } 

you can use errorplacement option change positioning of error message

errorplacement: function (error, element) {     //check whether chosen plugin initialized element     if (element.data().chosen) { //or if (element.next().hasclass('chosen-container')) {         element.next().after(error);     } else {         element.after(error);     } } 

demo: fiddle


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -