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. Advertisements

  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. Advertisements

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. Replies:
    0
    Views:
    848
  2. Matthew Louden
    Replies:
    1
    Views:
    7,573
    Scott M.
    Oct 11, 2003
  3. =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=

    Help on HTML server control vs HTML control

    =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=, Sep 15, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    2,304
    =?Utf-8?B?c2VyZ2UgY2FsZGVyYXJh?=
    Sep 15, 2005
  4. engsol
    Replies:
    2
    Views:
    1,148
    Dan Bishop
    Jan 26, 2004
  5. Replies:
    8
    Views:
    731
    Magnus Lycka
    Aug 5, 2005
  6. flamesrock
    Replies:
    8
    Views:
    785
    Hendrik van Rooyen
    Nov 24, 2006
  7. Ro
    Replies:
    3
    Views:
    474
    Lawrence Kirby
    Jan 26, 2005
  8. Replies:
    1
    Views:
    570
    Teemu Keiski
    Jul 2, 2003
Loading...