pixeltocode
pixeltocode

Reputation: 5308

change error messages after form validation in Magento

how can i change the error message Magento throws after it validates the form? thanks

Upvotes: 2

Views: 4656

Answers (2)

lionel lemaire
lionel lemaire

Reputation: 1

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;
    }
}],

Upvotes: 0

pixeltocode
pixeltocode

Reputation: 5308

found it at

.../js/prototype/validation.js

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

Upvotes: 5

Related Questions