I have an amount text field allowing the value as "1,232,454.23", maxlength="12" . Database size is NUMBER(9,2) and it works fine.
When User tries to enter a number 123245444.23 (without comma) text field is allowing additional two digits but the database size is (9,2), getting large number error. How can I allow user enter value with or without comma but stop submitting to the server if the value is large without comma ? Below is regex I have.
$.validator.addMethod("verifyDecimalVal", function(value, element) {
return this.optional(element) || value == value.match(/^-?(?:\d+|\d{1,3}(?:[\s\.,]\d{3})+)(?:
[\.,]\d+)?$/);
},"Please enter valid amount");