View Full Version : need to maintain (6,2) precision for the values in text field 6 numerics and 2 decim

raikoti sravan kumar
27 Jun 2012, 5:09 AM
the text field should not allow more than 6 digits before the decimal and not more than 2 digits after decimal, i.e I should not be able to enter 7th digit before the decimal and 3rd digit after the decimal.

for this I can't use maxsize and enforcemaxlength attributes because it will only support integer precision not floating precision.

I tried the below code implementing keydown and keyup events and using the substring functionality but its not working
keydown :
function( textfield , e,eOpts ) {

please help


27 Jun 2012, 9:52 AM
Use a number field and this


or write a custom Regexp or ther method it validate your input in a text field ...