Select to view content in your preferred language

Conditional Requirements Not Responding Correctly in Survey123 Connect Form

2172
14
11-15-2024 03:20 PM
Teresa_Blader
Frequent Contributor

Update (Feb 27 2025): 

This issue ended up being three issues. 

1. utilizing esri:visible to control visibility with questions inside of groups/pages caused issues with the conditional expressions I was using to control "require". Once I removed those questions from all groups/pages - it functioned properly. Esri support is still exploring if this is intended (lol) or if a bug is needed.

2. utilizing esri:visible to control visibility with questions inside of groups/pages caused the red error box at the top of the next page right after clicking "next". Once I removed those questions from all groups/pages - it didn't behave that way... mostly because there were no more pages and groups. Esri support is still exploring if this is intended (lol) or if a bug is needed.

3. then there was the behavior of questions turning red and showing the message before they are being interacted with when "require" and "revelant" evaluates to true and uses conditional expressions (so not just yes). Esri says this is an expected behavior, but the oddity is that I have other questions utlizing the exact same "relevant" conditional expression and "require" conditional expressions that do not display as red or a red message when those expressions evaluate to true. So Esri support is hopefully exploring this behavior, but is unclear as they keep saying it's expected behavior.

 

 

 

 

Survey123 Connect form: I'm noticing really odd behaviors between the conditional required, relevant, esri:visible fields that is really throwing me for a loop.

I have a conditional required question: if referral = yes, then name and date of birth are required. Pretty simple.

However it's requiring it no matter what and when I say required referral = no for another question - it doesn't add a requirement. I'm totally perplexed.

I tried if(${field} = 'Yes','yes','') or selected(${field},'Yes'). Nothing seems to get it to behave correctly. I tried adding recalculate url parameters (web form url embedded in Dashboards in edit mode).

I'm also noticing my required messages are showing before anyone has had a chance to answer the question. Like as soon as relevant or esri:visible is true. And it's announcing them as survey errors at the top when a new conditional required question is shown, especially when navigating page to page.

I'm sure I'll ask someone to put an esri ticket in for me, but figured I'd start here.

Attached is my XLM form (service urls removed). Is there something I'm doing wrong between the required, relevant, esri:visible fields? Like some rule I don't know about? Like esri:visible and required don't mix? I have multi level groups and pages and maybe there's something I'm missing. I'm using esri:visible because there are some questions that I need to calculate even when their not relevant.

Teresa_Blader_1-1731712005648.png

Teresa_Blader_3-1731712102764.png

 

Teresa_Blader_2-1731712066601.png

 

Pictured is right after I got to this page (page 2 of 2), automatically showing errors:
That seems weird! Like, sure once I click submit for this page, show the errors.. but not before??? 

Teresa_Blader_0-1731711941274.png

 

Teresa Blader
Olmsted County GIS
GIS Analyst - GIS Solutions
0 Kudos
14 Replies
Teresa_Blader
Frequent Contributor

And here's an example of how sometimes the requirement statements appear automatically when a requirement condition is met and sometimes it doesn't. All five of these questions have conditional requirements and statements. These should only appear if someone tries to submit or click next on the page and they are not filled out yet.

Teresa_Blader_0-1731973580174.png

 

Teresa Blader
Olmsted County GIS
GIS Analyst - GIS Solutions
0 Kudos
abureaux
MVP Frequent Contributor

That is really just a "visual eccentricity" as everything is "working as intended".

In the case of "Last Name" and "DOB", both questions are still required, and both questions must be filled in prior to the form sending. If you try and press the send button now, "DOB" will also be highlighted red. And in either case, adding a response to one of the red highlighted fields will remove that highlighting.

The only thing you can really do is make a post in the Ideas thread, and/or call Esri and open a case to log a bug.

0 Kudos
Teresa_Blader
Frequent Contributor

Right, my issue here isn't that the messages appear at some point, but when they appear. An error message at the top shouldn't appear until "Submit" or "Next" is clicked. Showing up before distracts the user and introduces confusion. Whether it's a constraint message or a required message, both were designed to alert the user after a question is incorrectly interacted with or "Submit" or "Next" is clicked - not before. To say "hey you missed this or got it wrong" not "in case you were thinking about skipping this question or entering it in wrong, don't". The red asterisk is all that should appear until the "Submit" or "Next" button is clicked.

Normal functioning surveys behave this way. Alerting the user after a miss or incorrect formatting, not before. Yes, interacting with the question removes the response, but for some reason the conditional statements I have in esri:visible is interfering with the behaviors. I've opened a support ticket with Esri and will hopefully get to the bottom of it!

Teresa Blader
Olmsted County GIS
GIS Analyst - GIS Solutions
0 Kudos
Teresa_Blader
Frequent Contributor

Try answering the Falls Prevention Referral Question - it is after this I am having the issue. I have a series of conditional requirements based on the answer to this question. I suspect the behavior is actually appearing for you too, because the requirement is showing before you hit submit correct? This is not how requirements work. They are only supposed to display the message after you've clicked it.

Teresa Blader
Olmsted County GIS
GIS Analyst - GIS Solutions
0 Kudos
Teresa_Blader
Frequent Contributor

Update: 

This issue ended up being three issues. 

1. utilizing esri:visible to control visibility with questions inside of groups/pages caused issues with the conditional expressions I was using to control "require". Once I removed those questions from all groups/pages - it functioned properly. Esri support is still exploring if this is intended (lol) or if a bug is needed.

2. utilizing esri:visible to control visibility with questions inside of groups/pages caused the red error box at the top of the next page right after clicking "next". Once I removed those questions from all groups/pages - it didn't behave that way... mostly because there were no more pages and groups. Esri support is still exploring if this is intended (lol) or if a bug is needed.

3. then there was the behavior of questions turning red and showing the message before they are being interacted with when "require" and "revelant" evaluates to true and uses conditional expressions (so not just yes). Esri says this is an expected behavior, but the oddity is that I have other questions utlizing the exact same "relevant" conditional expression and "require" conditional expressions that do not display as red or a red message when those expressions evaluate to true. So Esri support is hopefully exploring this behavior, but is unclear as they keep saying it's expected behavior.

Teresa Blader
Olmsted County GIS
GIS Analyst - GIS Solutions
0 Kudos