Validate textbox with mask

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jennLovingmomof5
    New Member
    • Apr 2009
    • 1

    Validate textbox with mask

    I need to validate a packslip using a mask. In the past I have validated that all characters are numbers and that the first one is not zero. Now they want to be able to set a mask, such as 9XX99999XX where the X is either a letter or integer, 9 would be integer only.

    This mask would be different for different suppliers.

    Thank you in advance!
    Jennifer
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    the best bet would probably be something around a Regular Expression.

    using 9XX99999XX it should be something like
    Code:
    RE = /\d[a-z0-9]{2}\d{5}[a-z0-9]{2}/i;
    // [I]sometimes[/I] [:alnum:] [I]can be used for[/I] [a-z0-9]
    an (more or less technical) explanation to the RegExp object can be found here.

    Comment

    Working...