SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard billy_111's Avatar
    Join Date
    Jul 2009
    Posts
    1,683
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Numeric field validation

    Hey,

    I was wondering if it is possible to validate tex boxes and check for numbers etc..

    Take a look at this page:-

    http://www.judgethejob.com/vinny/submit-review/

    I want to validate the "Average annual income" and "Holiday entitlement" fields.

    The salary field should be no bigger than 1000000 and should display to two deciaml places, and the holiday field should be no bigger than 99.9..

    Can i do this?

    Regards

  2. #2
    ********* Staff mattevans's Avatar
    Join Date
    Sep 2009
    Location
    Melbourne, Australia
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi billy_111,

    This is possible.
    You will need to take advantage of JavaScript Regular Expressions to validate the input of each field.

    Regular Expressions can get quite complex - so I recommend reading up about them first.

    Here are a few links to get you started...

    1. Google Search
    2. Reg Ex Library
    3. JavaScript Kit
    4. Dev Articles
    Matt Evans
    Sitepoint Developer
    tweet 2 me


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •