Javascript Mootools窗体。验证未触发事件
我不知道为什么Javascript Mootools窗体。验证未触发事件,javascript,validation,mootools,mootools-events,mootools-more,Javascript,Validation,Mootools,Mootools Events,Mootools More,我不知道为什么Form.Validate类在输入失败时不触发事件。这是我做的一个简单测试: HTML <form id="IndicatorIndexForm" action=""> <input type="text" id="IndicatorKilometers" data-validators="minLength:10" name="data[Indicator][kilometers]"/> <input type="submit" va
Form.Validate
类在输入失败时不触发事件。这是我做的一个简单测试:
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>
但是当我提交表单时,在控制台中我只看到“error”。如果我正确理解了文档,它还应该启动其他两个函数。。。我觉得我忘了什么。。有什么想法吗
这是JSFIDLE是的。事件的前缀上缺少
:
var myForm = new Form.Validator($('IndicatorIndexForm'), {
onFormValidate: function(resp,form,e){
console.log('error');
},
onElementFail: function(el,errors){
console.log('elementFail');
console.log(el);
console.log(errors);
},
onElementValidate: function(resp,el,validator,is_warning){
console.log('elementValidate');
console.log(resp);
console.log(el);
console.log(validator);
console.log(is_warning);
}
});
._. ...就像我的老师常说的:“当你在js中出错时,99%的时间都是你的错,而不是mootool的错。”。。谢谢:)
var myForm = new Form.Validator($('IndicatorIndexForm'), {
onFormValidate: function(resp,form,e){
console.log('error');
},
onElementFail: function(el,errors){
console.log('elementFail');
console.log(el);
console.log(errors);
},
onElementValidate: function(resp,el,validator,is_warning){
console.log('elementValidate');
console.log(resp);
console.log(el);
console.log(validator);
console.log(is_warning);
}
});