Hi,
I am working on a survey that will eventually be public facing. There is a question “Are you closing a lane of traffic” that conditionally opens up a repeat section if the user answers ‘yes’. If the answer is yes, at least one record is required in the repeat. The user should not be able to submit the survey with an answer of yes but have no repeats.
I set up a conditional query. It only engages when the user says yes to a closure, and uses the count function of a required field within the repeat to total the entries. The constraint on that field is greater than zero, so if activated and no records appear, the constraint message pops up.
This works as intended within the Survey123 Connect preview (image: connect_success). However, upon publishing, the web version starts with the repeat expanded if enabled (image: web_default) and then the user can hit the trash can to delete the record (image: web_delete). If deleted, the user can successfully answer ‘yes’ to the closure question and not input an entry - the error doesn't come up.
Any insight as to
Thanks so much.
Looks like it is related to the known bug where Survey123 won't evaluate a field if a question is hidden or not relevant. This is a bug that's been around for years: https://community.esri.com/t5/arcgis-survey123-questions/survey123-required-column-on-text-and-selec...
Seems like what is happening is that, when the first repeat instance is deleted, the repeat is becoming hidden. As soon as a question is hidden, Survey123 won't evaluate it for required or constraint.
There is a fairly simple work around: see the attached .xlsx sheet.
You'll notice that this only works because it forces the survey to make the the conditional query itself visible. By making the query visible, Survey123 evaluates it for constraints and requirements. As soon as you set that query to calculate [type], or if you set [appearance] to hidden, the problem remerges because the question is hidden.
This is a serious bug, and it's bit disappointing that it hasn't been addressed for several years.
Interesting, thanks Lawrence. It's crazy to me that the hidden query (which is essentially how I deployed a workaround) functions in Survey123 Connect but then completely fails in the published web version. Made things extra frustrating given I can't test until published.
I appreciate your help.