Date of Birth / Over 18 | Community
Skip to main content
Answered

Date of Birth / Over 18


Forum|alt.badge.img

Hi there,

I ask for clients date of birth in a factfind questionnaire. I’ve had instances where the client would input 2024 as the birth year. Is there a logic / rule that would only allow dates over 18 years to be input?

Thanks

Best answer by Liz

Hi @Cat88 Thanks for stopping by the community! You could set a logic like this: 

And then in the go-to part, you could send them to a statement block that says something like, “Sorry, only over the age of 18” or the ending page with this information as well!

View original

9 replies

Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14984 replies
  • Answer
  • March 15, 2024

Hi @Cat88 Thanks for stopping by the community! You could set a logic like this: 

And then in the go-to part, you could send them to a statement block that says something like, “Sorry, only over the age of 18” or the ending page with this information as well!


Forum|alt.badge.img
  • Author
  • Explorer
  • 7 replies
  • March 19, 2024

Thanks Liz. If it goes to a ‘Statement’ block, can they go back to rectify the DOB and then continue the rest of the survey, DOB question is an early question in a c.20 min survey


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14984 replies
  • March 19, 2024

Hi @Cat88 Yes, the respondent should still be able to return back to that question to adjust their response. If you don’t want them to, you could send them to an ending instead. 


Forum|alt.badge.img
  • Author
  • Explorer
  • 7 replies
  • March 21, 2024

Thanks Liz, is there a way that the logic can be automatically updated so I dont have to update the logic year every year, i.e. DOB before 2006 this year, 2007 next year and so on?


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14984 replies
  • March 21, 2024

Hi @Cat88 While we don’t have this feature in the platform, you could try to set this up programmatically using our APIs


  • Navigating the Land
  • 2 replies
  • May 20, 2024

Hi @Liz ,

I'm with the same issue as @Cat88 !

How can we set this up using APIs? Can you give us more details?

Thanks a lot!


picsoung
Typeform
Forum|alt.badge.img+5
  • Developer Advocate @ Typeform
  • 390 replies
  • May 21, 2024

Hey folks,

Let’s check how to do this via API.

I replicated this flow 


The form is available at https://form.typeform.com/to/c1c4UG4t

Now let’s check the logic in the API calling our Retrieve form endpoint
GET https://api.typeform.com/forms/{form_id}

This returns a JSON with the whole structure of the form. Included a logic section.

"logic": [
    {
      "type": "field",
      "ref": "01HYD9Z8BT8FQM7NXW73H4C9R9",
      "actions": [
        {
          "action": "jump",
          "details": {
            "to": {
              "type": "thankyou",
              "value": "01HYD9Z8BTTH88A1H9YRQCCGPF"
            }
          },
          "condition": {
            "op": "later_than",
            "vars": [
              {
                "type": "field",
                "value": "01HYD9Z8BT8FQM7NXW73H4C9R9"
              },
              {
                "type": "constant",
                "value": "2006-05-21"
              }
            ]
          }
        }
      ]
    },
    {
      "type": "field",
      "ref": "1c864771-efad-46ff-b92f-8d18ff9d079e",
      "actions": [
        {
          "action": "jump",
          "details": {
            "to": {
              "type": "thankyou",
              "value": "cb65e194-fa8d-47db-ae23-bbd97ebe7ad8"
            }
          },
          "condition": {
            "op": "always",
            "vars": [

            ]
          }
        }
      ]
    }
  ],

You can see the first part where it defines the “2006-05-21” constant.
You can modify it and then re-upload the whole form definition using the Update Form endpoint

PUT https://api.typeform.com/forms/{form_id}

And now you have a script that calls this flow daily, and it will move the over 18 date.

Hope this helps


Liz
Community Team
Forum|alt.badge.img+5
  • Tech Community Advocate
  • 14984 replies
  • May 21, 2024

Oh wow thanks for this, @picsoung ! 😀


  • Navigating the Land
  • 2 replies
  • May 22, 2024

@picsoung thanks a lot!!


Reply