I am trying to ensure that the user can only enter a decimal. I found a reg expression that checks for this, but it's seemingly working in the reverse of how I'd like it to. Right now if the user enters a non decimal the button on my form gets enabled. I want the button to get enabled only if the user enters a decimal. Here is my code.
decimal: function (val/*,rule*/){
if(!val){
return true;
}
return /^[0-9]{1,6}(?:[,.][0-9]{0,5})?$/.test(val);
},