I don't know why the Form.Validate
Class is not firing the events when an input fails. This is a simple test I've made:
HTML
<form id="IndicatorIndexForm" action="">
<input type="text" id="IndicatorKilometers" data-validators="minLength:10" name="data[Indicator][kilometers]"/>
<input type="submit" value="Valider" class="">
</form>
JS
var myForm = new Form.Validator($('IndicatorIndexForm'), {
onFormValidate: function(resp,form,e){
console.log('error');
},
elementFail: function(el,errors){
console.log('elementFail');
console.log(el);
console.log(errors);
},
elementValidate: function(resp,el,validator,is_warning){
console.log('elementValidate');
console.log(resp);
console.log(el);
console.log(validator);
console.log(is_warning);
}
});
but when I submit the form, in the console I only see "error". If I understood correctly the documentation, it should also fire the other two functions... I feel that I'm forgetting something.. any ideas?
here's the jsfiddle http://jsfiddle.net/HJX3K/2/
yes. you are missing
on
prefix for the events: