Time Control in HTML

Discussion in 'HTML' started by Doogie, Nov 28, 2007.

  1. Doogie

    Doogie Guest

    Hi,
    I need to build a time control in HTML and am looking for some advice
    for the best way to do this. I need the control to allow users to
    enter a time in the following format "11:46 am" and have it complain
    when they do not. Any ideas would be helpful, up to and including if
    there is code out there that already does this. I'm figuring some of
    this will have to be done in javascript (because this is for an old
    legacy asp app I'm doing this in) but am starting here first in this
    group.
    Doogie, Nov 28, 2007
    #1
    1. Advertising

  2. Gazing into my crystal ball I observed Doogie <>
    writing in news:54fe68db-d514-4af4-b761-
    :

    > Hi,
    > I need to build a time control in HTML and am looking for some advice
    > for the best way to do this. I need the control to allow users to
    > enter a time in the following format "11:46 am" and have it complain
    > when they do not. Any ideas would be helpful, up to and including if
    > there is code out there that already does this. I'm figuring some of
    > this will have to be done in javascript (because this is for an old
    > legacy asp app I'm doing this in) but am starting here first in this
    > group.
    >


    Cannot be done with HTML alone. Client side script for validation is a
    good idea, but you really need to do validation on the server to account
    for those who do not have javascript enabled.

    Now, one thing you _could_ do is present the input in two select boxes,
    eg:

    <select name="hour">
    <option value="0">12am</option>
    <option value="1">1am</option>
    ....
    <option value="23">11pm</option>
    </select>
    <select name="minute">
    <option value="0">00</option>
    ....
    <option value="59">59</option>
    </select>

    Then you can put the two values together server side to make your time.

    Now

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne Boswell, Nov 29, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    1
    Views:
    6,885
    Scott M.
    Oct 11, 2003
  2. engsol
    Replies:
    2
    Views:
    933
    Dan Bishop
    Jan 26, 2004
  3. Replies:
    8
    Views:
    462
    Magnus Lycka
    Aug 5, 2005
  4. Peter Hansen
    Replies:
    0
    Views:
    706
    Peter Hansen
    Feb 22, 2006
  5. flamesrock
    Replies:
    8
    Views:
    435
    Hendrik van Rooyen
    Nov 24, 2006
Loading...

Share This Page