Thursday, April 12, 2012

Magento - remove from validation text

Some of us may not want the validation advice that is given, and prefer to just use CSS styling.
Here is how to remove it:
in /js/prototype/validation.js

test : function(nameelmuseTitle{
        
var Validation.get(name);
        var 
prop '__advice'+name.camelize();
        try 
{
        
if(Validation.isVisible(elm) && !v.test($F(elm), elm)) {
            
//if(!elm[prop]) {
            /*
                var advice = Validation.getAdvice(name, elm);
                if (advice == null) {
                    advice = this.createAdvice(name, elm, useTitle);
                }
                this.showAdvice(elm, advice, name);
            */
            //}
            
elm[prop] 1;
            
elm.removeClassName('validation-passed');
            
elm.addClassName('validation-failed');
            return 
false;
        
else {
            
//var advice = Validation.getAdvice(name, elm);
            //this.hideAdvice(elm, advice);
            
elm[prop] '';
            
elm.removeClassName('validation-failed');
            
elm.addClassName('validation-passed');
            return 
true;
        
}
        } 
catch(e{
            
throw(e)
        
}
    }
,

1 comment:

  1. hanks for the best blog.it was very useful for me.keep sharing such ideas in the future as well.this was actually what i was looking for,and i am glad to came here!
    magento development company in bangalore 

    ReplyDelete