restricting textbox input

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hollykatong
    New Member
    • Sep 2006
    • 1

    restricting textbox input

    hello,

    is there a way to restricting a textbox input wherein it will only accept two integer with decimal places? for example if i enter 90 or 90.1234 it will allow me and when i try to type 890 or 890.7832 it will not accept it.

    any help will be greatly appreciated. :)
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by hollykatong
    hello,

    is there a way to restricting a textbox input wherein it will only accept two integer with decimal places? for example if i enter 90 or 90.1234 it will allow me and when i try to type 890 or 890.7832 it will not accept it.

    any help will be greatly appreciated. :)
    I think you need to use a regular expression.
    Form a pattern and validate the input against that pattern

    Comment

    • abducted
      New Member
      • Sep 2006
      • 8

      #3
      Here's an introductory tutorial:
      http://javascriptkit.c om/javatutors/re.shtml

      and another at the same site:
      http://javascriptkit.c om/javatutors/redev.shtml

      but I think the best source is:
      http://www.regular-expressions.inf o/index.html

      Comment

      Working...