I am trying to add custom validation to age based on an earlier question on gender. If female is selected then the age should be 12-35 but if male is selected then the age should be 15-17.
I have tried (${member_gender}=1 and .=>12 and .<=35) or (${member_gender}=2 and .=>15 and .<=17) in the custom validation but not working.
Yes the gender is a select one., with option of either female or male. The other question is asking of age (number). I want to set validation on age that if female is selected earlier then age should be 12-35 and if male was selected then age should be 12-17.
I have tried using quotes (string) : (${member_gender}=β1β and .=>12 and .<=35) or (${member_gender}=β2β and .=>15 and .<=17)
It is a simple syntax error: greater-equal is >= (not => as you wrote).
Would you mind, please, to check your forms with the online validator during development (and preferably, also before posting). It would have marked the following error:
(You get the same error if you try to deploy your form in KoboToolbox. Itβs even a bit strange that you can Preview in KoboToolbox and Formbuilder without error message,)
In case you use the Formbuilder for development, you can easily download the form as XLSForm and upload it into the online validator for testing. (You can also use the Preview function there,)
To locate a problem, it is often helpful to strip down an expression (or a form) in simple elements, e.g. here just: . . => 12, which will already indicate the problem.