Little astrology program has 2 text input boxes for birth dates. There are 3
selects for day month year that will supply output to whichever text input
had the focus last. If the user picks from the list boxes the relative text
input field is formatted d/m/y, the format that the cgi is expecting. The
user can also input directly to the text inputs and I would like to route
whatever the user inputs through a filter using regexes wherever possible.
I can do this without regex but it will take a ton of code. Any help will be
appreciated. TIA
Jimbo
regex wherever possible
first check for pair of separators. possibly . , - / \ 'space '
then check for valid values between the separators.
day >0 && day<32
If there are alpha chars in the month field run it through an array
(jan,feb,etc and try to get a month number
month>1 && month<12
if the year is four digits
year>1929 && year<2010
if year is two digits parse to above format
else don't submit help user :>)
selects for day month year that will supply output to whichever text input
had the focus last. If the user picks from the list boxes the relative text
input field is formatted d/m/y, the format that the cgi is expecting. The
user can also input directly to the text inputs and I would like to route
whatever the user inputs through a filter using regexes wherever possible.
I can do this without regex but it will take a ton of code. Any help will be
appreciated. TIA
Jimbo
regex wherever possible
first check for pair of separators. possibly . , - / \ 'space '
then check for valid values between the separators.
day >0 && day<32
If there are alpha chars in the month field run it through an array
(jan,feb,etc and try to get a month number
month>1 && month<12
if the year is four digits
year>1929 && year<2010
if year is two digits parse to above format
else don't submit help user :>)
Comment