The below example is to validate the number,which will accept only numbers and .0 or .5 ,not more than 4 digits.
<aui:input name="" label="">
<aui:validator name="required"></aui:validator>
<aui:validator name="custom" errorMessage="This field should be in correct NumberFormat only!!">
function(val, fieldNode, ruleValue)
{ var a= val;
if(/^([1-4]{0,1})([0-9]{1})(\.[0,5])?$/.test(a))
return true;
else
return false;
}
</aui:validator>
</aui:input>
<aui:input name="" label="">
<aui:validator name="required"></aui:validator>
<aui:validator name="custom" errorMessage="This field should be in correct NumberFormat only!!">
function(val, fieldNode, ruleValue)
{ var a= val;
if(/^([1-4]{0,1})([0-9]{1})(\.[0,5])?$/.test(a))
return true;
else
return false;
}
</aui:validator>
</aui:input>