Restricting input field characters (html forms)

Discussion in 'JavaScript' started by locus, Feb 25, 2007.

  1. #1
    I am trying to restrict input to a date field, so that it only accepts the format
    YYYY-MM-DD.

    I need somthing like regular expression where an can declare a format so that my client can only enter characters in my format, and in the oreder specified by the format.

    Any suggestions are gladly welcomed.

    Thanks a million for your attention.
     
    locus, Feb 25, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Why not using three combo boxes:
    - One for year with valid years
    - Other for months with values 01..12
    - Other for days with values 01..31

    But you need to do some more checkings to avoid dates like February/30. Also , you should check again in your server.
     
    ajsa52, Feb 25, 2007 IP