Announcement

Collapse
No announcement yet.

Need to Capture and Validate Date of Birth

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need to Capture and Validate Date of Birth

    I sell electronic cigarettes (www.tropicalvapors.com). New regulations are coming down that will mandate that I capture the date of birth at registration and validate that the user is over 18 years of age. I will then manually validate the entered information against third party databases with the hope of automating the process in the future. I know that the IDOLOGY integration provides this functionality but the $800 installation fee and $1500 a month minimum was way beyond my budget.

    So I decided to code the data entry and the validation myself. I set up a test store, Welcome to Tropical Vapors - Test Store - Sample Slogan. I decided to use the "additional_field1" in the customer record to contain the date of birth.

    I successfully implemented the data entry in the registration template and got the redisplay and entry working on the update registration template. Since I also will have to capture the DOB for existing customers I went to add the code to the single page checkout. That is where I ran into a wall.

    I don't know if the variable additional_field1 is not available or I have a coding error. I contacted tech support and they pointed me to the "Guide" for the code blocks and variables for each template. The additional_field1 was NOT listed as available for single page checkout but it wasn't listed for the registration page either and I know it is available as I have successfully used it.

    Here is the code I have implemented for each of the templates. I pretty much cloned how billing last name was handled in each situation. Note I have not done any of the scripting yet to validate the date syntax or determine whether they are 18 yet. I figured I would get the data entry done first.

    Registration Template - works just fine

    <!--START: Date of Birth Entry - Code added by Tom Crable-->
    <tr>
    <td align="right" class="item"><b>Birth Date (MM/DD/YYYY)</b></td>
    <td><input name="additional_field1" type="text" id="additional_field1" maxlength="10" size="15" class="txtBoxStyle">
    <!--START: req_DOB-->
    <img src="assets/templates/common/images/error2.gif" width="12" height="12" alt="" />
    <!--END: req_DOB--></td>
    </tr>
    <!--END: Date of Birth Entry - Code added by Tom Crable-->

    Update account template - works just fine

    <!--START: Date of Birth Entry - Code added by Tom Crable-->
    <tr>
    <td class="item" align="right">Birth Date (MM/DD/YYYY)</td>
    <td class="item"><input size="10" name="additional_field1" value="[additional_field1]" class="txtBoxStyle"> </td>
    </tr>
    <!--END: Date of Birth Entry - Code added by Tom Crable-->

    Single page checkout template - behaves as though it doesn't recognize additional_field1

    <!--START: Display Enter DOB Code - Added by Tom Crable-->
    <tr>
    <td align="right" class="item"><b>Date of Birth (MM/DD/YYYY)]</b></td>
    <td nowrap><input name="additional_field1" type="text" onChange="clearContent(this);" id="additional_field1" value="[additional_field1]" size="15" class="txtBoxStyle">

    <!--START: additional_field1-->
    <img src="assets/templates/common/images/error2.gif" width="12" height="12">
    <!--END: additional_field1--></td>
    </tr>
    <!--END: Display Enter DOB Code - Added by Tom Crable-->

    -------------------------------------------------------------------------
    Any advise would be greatly appreciated, even if it requires a totally different approach. Thanks in advance

  • #2
    Support's answer is basically correct, which is that the checkout template does not use or look for additional fields. You'll need to work around by using some other field.

    I'd probably suggest using a required Checkout Question

    Comment


    • #3
      Originally posted by cbsteven View Post
      Support's answer is basically correct, which is that the checkout template does not use or look for additional fields. You'll need to work around by using some other field.

      I'd probably suggest using a required Checkout Question
      I've had the required checkout question, terms and conditions attesting to age, etc. from the beginning. Unfortunately, the way I have read the preliminary draft of the Ohio legislation, I have to capture and then verify the exact age of the purchaser. That means a birth date.

      Comment


      • #4
        Sure, and you can use a checkout question text field to capture a birthday.

        Comment


        • #5
          take the text box from the cart question and validate it with javascript. either against a regex or maybe use date.js to help the process along a bit.

          Comment

          Working...
          X