SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Month/Year Validation

    Hi..guys! I have two textfields which accept valid month and year value.I need to validate them in order to accept data in MM/YYYY.

    The slash is ready on the design,how could I validate the input?It's not mandatory to have leap year checking.A normal date validation will do.Thanks...

    Code HTML4Strict:
    <tr>
    <td width="280">Month / Year:</td>
    <td width="480" >
    <input name="month" type="text" size="2" /> / <input name="year" type="text" size="4" />
    <span>(For example: 01/2008)</span>
    </td>
    </tr>

  2. #2
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone can help me figure it out?Thanks a lot...

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,608
    Mentioned
    24 Post(s)
    Tagged
    1 Thread(s)
    validate the month between 1 and 12 and the year for numeric.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •