View Full Version : Validation with Javascript

05-16-2007, 05:43 AM
Hi I have a small problem, I am not a strong coder and need some advice on how to do time and date validation through javascript

my main coding language is php though doing validation through javascript

what I need to do is the following:

- the starttime needs to be inputted as hh:mm (no seconds are needed) and the format will be army time so a 24 hour clock
- the starttime can only be in 30 minute lots, so a user can enter any hour up to 24 but the minutes can only be 00 or 30 nothing in between or after.
- the endtime needs to have a loop that will call the starttime and add 30 minutes or 1 hour depending on what radio button you choose, for example if a user enters 11:00 then the end time will be either 12:00 or 11:30.

If anyone can help me I will be extremely grateful :confused: I am so lost on how to do this and I cannot seem to find relevant information on the internet that will work for the 30 minute/hour increments :(

My current code is attached as 'addprogram' it should be a php file, and the database.txt contains the database structure, I am using wamp5 which has mysql as the database creator

I am sorry if i have created this topic in the wrong section, I am also new to this forum so still trying to get used to things.

05-16-2007, 01:34 PM
Why are you doing the validation in javascript? It is client-side based, and there are numerous people that have javascript disabled, either by default/annoyance/malicious. I highly suggest that you re-sanitize / re-validate using your php script.