Posted by Adrienne Boswell on 11/29/07 02:52
Gazing into my crystal ball I observed Doogie <dnlwhite@dtgnet.com>
writing in news:54fe68db-d514-4af4-b761-
cc6110d3d99c@j20g2000hsi.googlegroups.com:
> 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
[Back to original message]
|