PDA

View Full Version : Validating forms


tommtomm
11-18-2009, 05:08 PM
Hi all, I hope you can help.
I am building a form for doctors to fill in the last 5 years address.
As you can imagine people move around and some have up to 8 adresses.
I would like to lern how to compare the dates of each addresss, so that if they by accedent have overlapping dates it warns them and will not let them send the form.
Or maybe a date selector that will not let them select overlapping dates.
Not sure which is easier to do.
If any1 has any idea of how to do this, please let me know what I would have to learn, ie Javascript, PHP as I am not a programmer.

Thanks for your help.

edbr
11-19-2009, 12:22 AM
in php you can compare dates so i would say it could be done this way, what if a patient has 2 address at the same time though?

tommtomm
11-19-2009, 08:30 AM
thanks for the reply.
Yes you are right they might have 2 addressess but they must be living in 1 location at a time. This is a form for a police check and the police have to have continous addresses, for example:

2 Funny road
London
W12 8gh
UK
sep/2009 - Nov/2009

The one before that must match.

2 Silly road
London
w12 8qb
UK
Jan/2004 - sep/2009

see how the date of the second address matches the date of when they moved to new address.

They must match and not overlap.

But it could have dates like:

Jan/2004 - Aug/2009

This is also acceptable as it is clear that the next month (sep) they moved to the new address.

Sorry if this is a bit confusing, but the police must get the info this way otherwise they will not accept it. and the form gets rejected.

If you are able to do it in PHP, What words should I use to try and search for this type of coding. What I mean is, what branch of PHP should I look under to learn how to do this type of validation.

again many thanks for trying to help me.

edbr
11-20-2009, 01:19 AM
ok , try the tutorials at tizag for date ( i warn you though it is not the simlest of php) and yahoogle date compare. PHP you will fint lots . i will have a look later i know i have a function for it but will have to look into no overlap . im certain it cn be done though

tommtomm
11-20-2009, 09:25 AM
Thank you edbr, your a saint. I will look up those tutorials and try to work it out. I hope its not too difficult, but I guess if you want something specific you always have to spend more time.