validation - jquery mobile validate "data-native=false" selectbox on change not working -
i'm running odd problem.
i'm using jquery mobile , know validate plugin. works fine except when turn false data-native attribute. error message appears on submit, never disappears onchange. i'm missing something? update1: more weird, updates when click on error message, or on submit button
html code:
<div id="invalid-id_form_choose" class="errors"></div> <select id="id_form_choose" name="question" data-theme="b" data-native-menu="false" class="question"> <option value="">veuillez choisir</option> <option value="first_pet_name">quel est le nom de votre premier animal de compagnie ?/option> <option value="mother_place_of_birth">dans quelle ville est née votre mère ?</option> </select>
js code:
jquery.validator.addclassrules({ question:{ required: true } }); jquery.validator.setdefaults({ errorplacement: function(error, element) { error.appendto('#invalid-' + element.attr('id')); } }); $(document).bind('pageinit',function(){ $("#step1_form").validate({ messages:{ question:{ required: "veuillez renseigner ce champ obligatoire" } } });
css code
.errors{ color:red; }
data-native=false
hide original select box.
to validate need enable validation of hidden fields.
read more here: jquery validate - enable validation hidden fields
Comments
Post a Comment