Hi guys
i want to check the value of an answer such that is 'no' is selected the do
not continue or give and error.
example
1.Gender
a. Male
b. Female
for this question i want to put a validation or control that if option
female is selected the give an error message
Hi Coulson,
Use the selected() function. Brief docs:
selected(field, value): True or false depending on whether the item
indicated was selected in a select_one or select_multiple field (as in the
relevance "selected(${fieldname}, 'Male')").
As the second parameter, include the selected value, not the label text.
Best,
Chris
ยทยทยท
On Mon, May 20, 2013 at 9:56 AM, Coulson Thabo Kgathi wrote:
Hi guys
i want to check the value of an answer such that is 'no' is selected the
do not continue or give and error.
example
1.Gender
a. Male
b. Female
for this question i want to put a validation or control that if option
female is selected the give an error message
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
thanks but i was currious if this would work but will try it anyway:
"selected(${.}, 'Male')").
because i want to refere to the same field that i am puting the validation
on.
so the validation is for the same question.
maybe i should have asked the question this way.
- Is the respondent eligible?
hint: If no stop the survey and dont allow the form to be save.
a. Yes
b. No
os i want to use the anser i get to validate the form
so maybe on the constraint i could say:
CONSTRAINT
.=="no"
CONSTRAINT MESSAGE
"You selected No so you cannot continue with this form"
Hi Coulson,
For this sort of thing, the standard approach is to put all following
questions inside a group with an appropriate relevance condition. For
example, all of our sample forms have a "consent" question which is yes/no
(1/0), and then there's a "consented" group with relevance "${consent}=1"
in which we put all consent-requiring questions. That way, you can at least
save the form when somebody refuses consent.
Best,
Chris
ยทยทยท
On Mon, May 20, 2013 at 1:07 PM, Coulson Thabo Kgathi wrote:
thanks but i was currious if this would work but will try it anyway:
"selected(${.}, 'Male')").
because i want to refere to the same field that i am puting the validation
on.
so the validation is for the same question.
maybe i should have asked the question this way.
- Is the respondent eligible?
hint: If no stop the survey and dont allow the form to be save.
a. Yes
b. No
os i want to use the anser i get to validate the form
so maybe on the constraint i could say:
CONSTRAINT
.=="no"
CONSTRAINT MESSAGE
"You selected No so you cannot continue with this form"
--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en
You received this message because you are subscribed to the Google Groups
"ODK Community" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to opendatakit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
1 Like
your post has been very helpful
thanks