Thread: DOB Validation

Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2011
    Posts
    58
    Plugin Contributions
    0

    Default DOB Validation

    Hey guys, is there anyway to remove the validation on the forms for the DOB? ie. Customers can enter something like 20 March 1999 instead of 03/20/1999 ?

    Any help would be great

    Many thanks

  2. #2
    Join Date
    Sep 2011
    Posts
    58
    Plugin Contributions
    0

    Default Re: DOB Validation

    Anyone? Surely there is someone who would know about this?

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: DOB Validation

    The lack of response is because none of us really know why you would want to do this in the first place (Well, that's my guess).

    If you aren't interested in having the DOB validated then there isn't much point in obtaining the data in the first place.

    Furthermore unless the date is in a format recognisable to zencart it wouldn't find it's way into the database, so invalid entries will show as 01/01/01

    In short, regardless of whether it is possible or not is somewhat irrelevent. It is simply a pointless thing to want to do.

    Cheers
    Rod

  4. #4
    Join Date
    Aug 2005
    Location
    Vic, Oz
    Posts
    1,905
    Plugin Contributions
    5

    Default Re: DOB Validation

    Maybe the OP still wants to validate it.
    But allow it to entered in a "freeform" way such as "20 March 1999"?

    Seeing the different date formats available around the world it would be impossible to correctly validate it all the time in a "freeform" way.

  5. #5
    Join Date
    May 2012
    Posts
    1
    Plugin Contributions
    0

    Default Re: DOB Validation

    surely some one would be thr.. some one will answer to ur ques.

    Online Degrees
    Online Programs

  6. #6
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: DOB Validation

    Quote Originally Posted by gilby View Post
    Maybe the OP still wants to validate it.
    I had considered that myself, but I read, and re-read what was stated, and no matter how hard I tried I simply couldn't find a way to translate

    "is there anyway to remove the validation on the forms for the DOB" into anything remotely like "is there anyway alter the validation on the forms for the DOB"

    Even the next sentence didn't tip me off either, which I read as:

    "ie. Customers can enter something like 20 March 1999 instead of 03/20/1999, Or the 10th blue moon in the second quarter of the the year after I was born"

    Quote Originally Posted by gilby View Post
    Seeing the different date formats available around the world it would be impossible to correctly validate it all the time in a "freeform" way.
    So basically, even though you added a 'maybe' clause, you still came to the same conclusion that I did.
    How am I supposed to interpret that?

    Cheers
    Rod

  7. #7
    Join Date
    Sep 2011
    Posts
    58
    Plugin Contributions
    0

    Default Re: DOB Validation

    Basically customers using the site are moaning that its a pain to have to enter the DOB in such a fashion, and wanted to remove the validation so its essentially just a text box, the reason for needing the DOB is for cross reference on applications and direct debit mandates and such.

    So its quite important that the DOB field is there, but would like to make it less strict on its validation, it doesnt even need to be validated, just a text box labelled DOB would do for me! lol :)

    Thanks for the replies, and i hope this makes a little more sense

  8. #8
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: DOB Validation

    eddy_r3,

    I understand what you are wanting, and even the reasons for wanting it, but, although it may appear that it should be easy to skip the validation checks it practice it is going to be a little more complicated.

    The situation is that this data is stored in the database using a special data type called 'datetime' (which at its core, is a number field). As such, it is incapable of storing text data, which is why the validation checks are needed to ensure the data is correctly formatted.

    So, to do what you want AND store the data means that you'll either need to change the datatype that the store is using, which would be *very* unwise because there is no easy way of know what else is going to use that datafield, and if it has been changed, things can fail in rather catastrophic ways, OR you'll need at add a new column to the database table and then modify any code that stores or reads this data so that it references this new column. This would involve making edits and additions to at least 3 of zencart's core php files. Also a recipe for disaster.

    That's the bad news.

    The 'good' news is that PHP has some *very powerful* date/time handling methods... These are so good that you can *almost* enter freeform text and they'll correctly convert to the datetime format needed by the database. I've not looked, but I'll wager that Zencart already makes use of these to convert (say) 03/20/1999 to the datetime format (after it has done its validation). Theory dictates that a person could locate this code and *enhance* it so that other input formats (such as 20 mar 1999) will also be treated as 'valid' and therefore suitable for conversion to datetime. It is also (theortically) possible to skip all the validation checks and *hope* the conversion will still work, but this is FAR TO RISKY and will open the site up to SQL injection exploits.

    Furthermore, although the date() methods are quite good at what they do, they would be unable to determine if 03/11/2012 is meant to be the 3rd of Nov, or the 11th of March - The same format has a different meaning depending on which country you are from. This is yet another reason why strict validation is required.

    No matter how you look at it, it is not going to be an easy task and datetime issues have been the bane of many a good programmer.

    Bottom line, there are solutions to your problem, but it involves a lot more than simply not validating the input (which incidently would also fail any PCI tests).

    Cheers
    Rod
    Last edited by RodG; 11 May 2012 at 11:38 AM.

  9. #9
    Join Date
    Sep 2011
    Posts
    58
    Plugin Contributions
    0

    Default Re: DOB Validation

    Hi Rod, thanks for your reply, and it makes a lot more sense now :)

    My other question then, is there anyway to add fields into that form? Could i remove the DOB box altogether and replace it with a plain text box maybe?

    Thanks again
    Eddy

  10. #10
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: DOB Validation

    Quote Originally Posted by eddy_r3 View Post
    My other question then, is there anyway to add fields into that form? Could i remove the DOB box altogether and replace it with a plain text box maybe?Thanks againEddy
    I already answered that..............OR you'll need at add a new column to the database table and then modify any code that stores or reads this data so that it references this new column. This would involve making edits and additions to at least 3 of zencart's core php files. Also a recipe for disaster. CheersRod

 

 

Similar Threads

  1. DOB required
    By niccol in forum General Questions
    Replies: 4
    Last Post: 12 Apr 2011, 08:36 AM
  2. Foxed by DOB
    By Kryspen in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 19 May 2010, 11:36 PM
  3. Deleting DOB
    By SpeedBird3654 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 7 Oct 2008, 09:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR