开发者

change error messages after form validation in Magento

how can i change the er开发者_如何学JAVAror message Magento throws after it validates the form? thanks


found it at

.../js/prototype/validation.js

there's a list of the conditions and the error message that corresponds to it.


You can change the error message on the fly inside your validation function using this.error="custom message"

['validate-zip-extra', 'Please enter a valid zip code', function (v) {
        v = v.trim();
        this.error = "custom validation error extra";
        var regexpString = /^[0-9][0-9][0-9][1-9](\s)?([a-z]{2})$/i;
        return Validation.get('IsEmpty').test(v) || regexpString.test(v);
    } else {
        return true;
    }
}],
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜