You don't seem to have a grasp of the principles of coding. To wit: Code is executed in a LINEAR fashion, except when you make a call to a function or method. And even then, when the function/method returns, you continue in a linear fashion.
Your code in post #53 makes not one iota of sense.
*AFTER* your validateDOB function has checked to see if the y,m,d that was passed to it is valid *THEN* you go get the "dob" element from the form.
WHAT???? How can you validate something you haven't even gotten yet????
The sad part of this is that I handed you the answer on a plate in post #45, written nearly as simply as I could, and you just ignored it as being too complex. And then you produce this mess which is more complex and which doesn't work, at all.
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.