I recently asked this question and Doug Browning answered pretty quickly. Thanks for that.
Require one answer within group
I actually need to use this repeat group within another repeat group. I've attached a modified XLSForm to show that usage. My survey requires this case. When I add another person, the continent question is required (that's good) but, the city (1 required, up to 5) is not required. When I have one person and submit the survey, the city is required, but the constraint message is in an alert and the content is not auto-scrolled to the correct location. Worse, if I have two people and will a total of one city (one city per person should be required) then the survey is accepted.
Does anyone know how to require one city per person? Also, I prefer that the constraint is inline and not in an alert. And that the city is required when adding a new person (like the continent question).
That is tough due to the dependency cycle. Seems like a constraint of ${city_count}>=1 on the city_count_desc field seems to work.
Thanks. I moved the constraint of ${city_count}>=1 to the city_count_desc field. That's an improvement. It kind of works, but not completely.
Success:
Failure:
Does anyone see a solution for these cases?
Yes it gets confused with the repeat in a repeat. It is counting all responses which makes sense.
Can you just have 5 city fields instead? The backend table will be less pretty of course
You could also remove the repeat count of 5. Then make City required. They could then do more than 5 but not less than 1. You could give a warning past 5 though. Or even hide the fields of the count > 5 and have a message appear that says max of 5.
None are perfect but its a shot.
Yes! I believe that having five city fields would solve the issues I discovered. I could display each additional city field as they're entered. That is, after the first city is entered, display the question for the second city, and so on.
My question about entering 1 to 5 cities within a repeating group is relatively straightforward. In my actual survey, I have a select_multiple
This isn't a good user experience. I would also like a way to quickly review all answers before submitting the survey and that isn't easy (if it's possible).
I made an edit with 2 more ideas.