View Single Post
  #2 (permalink)  
Old April 8th, 2010, 09:21 AM
PeterPeiGuo PeterPeiGuo is offline
Friend of Wrox
 
Join Date: Dec 2008
Location: , , .
Posts: 238
Thanks: 2
Thanked 20 Times in 19 Posts
Default

Use regular expression, for example, /^[-+]?[0-9]*\.?[0-9]+$/. You may have to slightly adjust this to fit your specific needs. Your specific needs might be, for example: 1) Only accept numbers with two digits after decimal point; or 2) Accept 3. as a valid number and take it as 3.0.

Last edited by PeterPeiGuo; April 8th, 2010 at 09:36 AM..
Reply With Quote