Results 1 to 2 of 2

Thread: Date Validiator

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2004
    Location
    fda
    Posts
    17

    Date Validiator

    I have a textbox which requires to fill out date in the format mm/dd/yyyy
    I want to know how i custom my validiator to check if input is in right
    format

    Thanks

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Use a regular expression validator.


    Put this expression in the validation expression property:
    Code:
    ([1-9]|(0[1-9])|(1[0-2]))\/([1-9]|(0[1-9])|([1-2][0-9])|3[0-1])\/[0-9]{4}
    That might not be exactly what you need, but it will get you started. In case you were wondering, it uses regular expression to match up the value entered to verify it is a correct date.

    I would still do a check on the server by trying to parse the text into a date object, and if it throws an exception, then kick that back to the user to reenter.

Posting Permissions

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



Click Here to Expand Forum to Full Width