fal*_*tcz 3 javascript prototype magento
我有默认的Magento表单验证问题.我在结帐页面使用手风琴,所以当我提交表单时,会隐藏一些字段.我注意到所有隐藏的字段都在通过验证,即使它们是空的(使用了必需的入口类).有没有办法强制验证脚本检查所有字段,而不仅仅是可见字段?
提前致谢.
我在这里找到了答案:http://awnist.com/blog/2011/05/02/overriding-magentos-form-error-mechanisms/
基本上,您需要为验证对象覆盖isVisible方法,以便始终从中返回true.加载/js/prototype/validation.js后加载此JS代码:
Object.extend(Validation, {
isVisible : function(elm) {
return true;
},
insertAdvice : function(elm, advice){
// advice contains the div that would normally be inserted.
}
});
Run Code Online (Sandbox Code Playgroud)
覆盖insertAdvice是可选的 - 如果要修改插入验证建议的方式,可以使用它.