How to add a custom validation to Magento prototype

后端 未结 2 647
自闭症患者
自闭症患者 2021-02-08 22:57

I want to make a simple url validator for some custom fields. I tried the default ones (adding the class validate-url or validate-clean-url to the inp

2条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 23:15

    You can create your own custom validation function using

    
    

    See http://magento-quickies.tumblr.com/post/6579512188/magento-custom-form-validation

    or

    if(Validation) {       
       Validation.addAllThese([     
        [
            'validation-myown',      
            'Please insert proper word',   
            function(v,r){ return v.indexOf('valid')==-1?false:true } 
        ],
       [ ]   
    ])
    }
    

    see http://blog.baobaz.com/en/blog/custom-javascript-form-validators

提交回复
热议问题