Friday, May 17, 2013

Magento custom validation and remove forward and back slashes

var theForm = new VarienForm('theForm', true); 
Validation.add('validate-hello','You failed to enter!',
function(field_value){
if(field_value == 'hello')
{ return true; } return false; }); 


Lastly add your validation class to your input field.


http://magento-quickies.tumblr.com/post/6579512188/magento-custom-form-validation Another thing I have done today is a function removing backslashes and forward slashes
 v = v.replace(/\//g, '');
v = v.replace (/\\/g,'');

Where the variable is declared already.

No comments:

Post a Comment