Validations for TIME

G

Guest

I need user to input time in my specified time:

From Time hh:mm:AM/PM To Time : hh:mm:AM/PM

But both are free text

Any clues, ( other than suggesting me to change free text to dropdowns)
 
E

Eliyahu Goldin

Try to create a Date object from the user input:

dateObject = new Date (myTextBox.value);

If the call sets datObject to NaN, the string is not a valid time.

Eliyahu
 
K

Kevin Spencer

Any clues, ( other than suggesting me to change free text to dropdowns)

This is akin to asking if there is any other way to stop a car than applying
the brakes. Yes, there are other ways. There are no other GOOD ways.

The purpose of interface elements like drop-downs, check boxes, and radio
buttons is to prevent user input error. Humans are incredibly unreliable,
and often misspell there own names (yes, the misspelling was intentional).
It is best to leave the exacting stuff to computers, which lack creativity
but are incredibly reliable at repeating exactly what they've been told.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top