Avatar of sjamal_hsj
sjamal_hsjFlag for Canada

asked on 

Using jquery validation, how do I validate a Date of Birth with 3 different select boxes?

I have a signup form that I am validating using jquery, and I am trying to validate a Date of Birth that is spread across 3 different select boxes.

You can see this form at
http://www.rewardsring.com/sandbox/signup2V.html

My current approach is to create a hidden field next to the three select boxes and validate that instead (with the associated code necessary to build the value of that field).
I then wrote my own validation method (properDate) to make sure that dates like September 31st aren't permitted.
I also want the three select boxes to appear red if there is a problem with the date.

Unforunately, it doesn't seem to work at all, and I have no idea how to fix it, so any help is appreciated. (For example, Feb-31-1984 seems to be a valid date!?!?!)
JavaScriptWeb Languages and Standards

Avatar of undefined
Last Comment
sjamal_hsj
ASKER CERTIFIED SOLUTION
Avatar of dxdinh
dxdinh
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of sjamal_hsj
sjamal_hsj
Flag of Canada image

ASKER

In regards to the first solution, that doesn't really use jquery. Technically, using javascript, I know how to test for a valid date, but I wanted to do it using the jquery validation plugin.

For the second solution, it would work, but it does require a large amount of extra code. Also, it wouldn't solve my problem of validating 3 select boxes as a group using jquery.

Thanks for the input though
Avatar of dxdinh
dxdinh
Flag of United States of America image

I guess the question s/b how to extend jQuery validation plugin to date selection drop down list box.
Avatar of sjamal_hsj
sjamal_hsj
Flag of Canada image

ASKER

To be honest, I'm not sure if it needs to be extended. I'm new to jquery, and I was wondering if it was possible, using the jquery validation plugin, to validate a date that uses 3 select boxes.

If not, then I suppose I can change it to an input box.
Avatar of sjamal_hsj
sjamal_hsj
Flag of Canada image

ASKER

my question was perhaps more vague than it needed to be
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo