Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Contributor
2600 Points
484 Posts
May 08, 2012 07:02 PM|LINK
You can implement this with the help of JavaScript.
function checkDecimal(val) { if (val.length >= 3) if (/\d*\.\d\d$/.test(val)) return true; else { alert("Only two decimal places allowed"); return false; } } <input type="text" name="decimal" onKeyPress="return checkDecimal(this.value)">
Shellymn
Contributor
2600 Points
484 Posts
Re: Restrict the User to enter only 2 digits after decimal
May 08, 2012 07:02 PM|LINK
You can implement this with the help of JavaScript.
function checkDecimal(val) { if (val.length >= 3) if (/\d*\.\d\d$/.test(val)) return true; else { alert("Only two decimal places allowed"); return false; } } <input type="text" name="decimal" onKeyPress="return checkDecimal(this.value)">