Search code examples
validationformsmagentoprototypejs

Magento Validate Form Only Certain Fields


I have a function to validate all fields in a form:

validateForm: function() {
    var validator = new Validation(this.form);
    validator.validate();
}

There are two controls. First control need to validate only a,b,c fields. Second control need to validate only d,e,f fields. How can I achieve this?


Solution

  • To validate only a certain field, you can use:

    Validation.validate(document.getElementById(id));