Time Control in HTML

D

Doogie

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

Adrienne Boswell

Gazing into my crystal ball I observed Doogie <[email protected]>
writing in (e-mail address removed):
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top