I am new to KoboToolbox. I am developing a questionnaire for a quantitative survey in an XLSForm. We have three kinds of Informed Consent forms (adult, parent, child). If the participant is over 18, he/she fills out the adult consent. If the participant is under 18, a parent must fill out a consent from and the child must fill out an assent form.
I have created two text options in Kobo so the data collector can manually input the letter/number code of the consent/assent forms. For example, if the participant is an adult or parent, the data collector inputs AL001 or PL001 (A=adult; P=Parent). If the participant is under 18, a second text option that is not mandatory appears and the data collector can input CL001 (C=child).
I’d like to know if I can do the following.
If the data collector fills in the text box for an adult 18+ informed consent, I would like a conditional date of birth option where it will not allow the participant to enter a date of birth that would make him/her under 18.
If the data collector fills in the text boxes for a parent consent and child assent, I would like a conditional date of birth option that will not allow the participant to enter a date of birth that would make him/her 18 or older.
My questions are:
Can you setup conditional codes in excel for text options? If so, how?
Can you setup validation criteria for text options that would allow for text/number combinations?
I know how to setup the date-month option constraint, but I don’t know how to setup validations or conditionals with text.
Hi
Welcome to the community. I would like to recommend the following steps.
I would go for a different option where you add a single question e.g. Q1 with specific single response options e.g.
Step 1 What is the respondent type?
1= Adult
2= Parent
The third option is not needed
Now to tackle you second component you will note that I have created the above question to be a Single response question with response either being 1 or 2.
Steps 2
With this then (Q1) I would then create two dummy calculate questions using advance calculations as follows.
Note that I have made assumptions as follow
A child is someone aged 0 to 17 years
An adult child is aged 12 to 17
A minor child (requiring parent) is aged 0 to 11
Kindly change this parameters to fit your needs.
AgeMin (which would be the minimum age) use formula if(${Q1}=1,12,0)
AgeMax (which would be the maximum age) use formula if(${Q1}=1,17,11)
Remember these calculate questions would be dummy questions used to check the date of birth question.
Steps 3
Create your normal date of birth question (BIRTH_DATE) which is is a date question and add the restriction
Create an calculate question (AGE) that calculates the age using int((today() - ${BIRTH_DATE}) div 365.24)
You can then set a validation rule where AGE should have the conditional .>=${AgeMin} and .<=${AgeMax}
This should flag if the age is not fitting the specific band