I'm sorry for posting so many questions here on the forum.
Regarding select_one questions, Constraint:
not(selected(.,'B02'))
This 'constraint' will display an error when optionName B02 is selected.
This always happens when I am trying out validation on my forms. I am always confused on how Constraint really works.
Are conditions placed on contraint need to be what should not happen, or what should happen?
1. What is the problem? Be very detailed.
I have two select_one questions.
Q1 has 9 options
Q2 has 10 options
What I want to happen, is While Q1=opt 1-6 selected, and Q2=opt 2 selected, there would be an error.
2. What app or server are you using and on what device and operating system? Include version numbers.
I am using XLSForm Viewer to test the form: https://getodk.org/xlsform/
3. What you have you tried to fix the problem?
I have searched "Constraint on Select_one" on the net and this forum multiple times, but I have yet to find a solution to my problem.
- I first tried isolating the conditions, from which When Q1 opt 1-6 is selected it would display an error
not(.='A00' or .='A01' or .='A02' or .='A03' or .='A04' or .='A05' or .='A06')
- Then when Q2 opt 2 is selected, it would also display an error.
not(selected(.,'B02'))
- I tried combining the two:
not(selected(.,'B02') and .='A00' or .='A01' or .='A02' or .='A03' or .='A04' or .='A05' or .='A06' )
But then Q2 doesnt display errors
- Tried just separating them
not(selected(.,'B02')) and not(.='A00' or .='A01' or .='A02' or .='A03' or .='A04' or .='A05' or .='A06')
But then Q2 will always display error when opt 2 is selected.
5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.
ODK Tester (43).xlsx (39.0 KB)