Select to view content in your preferred language

Conditional Requirements Not Responding Correctly in Survey123 Connect Form

1763
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
abureaux
MVP Frequent Contributor

I see no issues in Connect OR the Web Form (examples below). You sure you are selecting the correct options while testing?

abureaux_0-1731949557032.png

abureaux_1-1731949564634.png

abureaux_2-1731949574051.png

 

0 Kudos
abureaux
MVP Frequent Contributor

Also, what version of Connect are you using? Current version is 3.21.62

0 Kudos
Teresa_Blader
Frequent Contributor

Thank you for testing for me!! I am at 3.20.

Your examples also aren't showing the page behaviors I have built into the form. There are two pages and the "would you like to continue questions" are supposed to be on page 1, and the referral question isn't supposed to appear unless "yes" is clicked or if it's a certain call type and location type. It's a bit of a complicated survey! 

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

I had to isolated the issue to just a few questions, and so deleted everything unrelated to the issue. You have capitals in the name column, so I can't publish as-is (Enterprise doesn't support capitals in the name column when published from Connect directly). I also am not familiar with how things conditionally show/hide, so there isn't much point playing hide and seek with the few questions I am looking for. That is why it looks different.

I was really just testing the conditional nature of ${FALLS_PREVENTION_REFERRAL} in that test.

This time, I kept as much as I could for the test. I still had to replace all the names (can't be avoided if I want to publish the form), as well as remove the data on the settings tab (this one can't be avoided by anyone), and a few unrelated fields. Again, will look different from yours, but the logic for the required column is untouched.

abureaux_0-1731950935639.pngabureaux_1-1731950942930.png

This appears to we working as intended.

Are you saying that the issue is simply the red showing up? Aka, this:

abureaux_2-1731951222467.png

If so: No, that is not a bug. That is "working as intended". The web app just marks questions that way when they are conditionally shown.

0 Kudos
Teresa_Blader
Frequent Contributor

Thank you!! It's the two issues for me. 

It looks like the requirements seem to be operating for you on their, but it's basically doing the opposite for me - so that's good for something. I'm wondering if it's related to the pages and groups, since you removed most of those it sounds like.

Requirement messages really are only supposed to display upon clicking "submit" or clicking "next" - not just when the question is revealed. That's how they behave on all of my other surveys. This is the first survey I've tried using the esri:visible field to help control visibility and this is the first time I'm running into this issue. And actually this behaves correctly sometimes for the first page if certain answers are given.

Sorry you can't use captials by the way. LOL gotta love it. 

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

Hmm. As I mentioned, I didn't touch the "required" logic, so it should be the same on both our Web Forms (as that is a universal base). The only real difference is Connect. Maybe try updating Connect to the more recent version and see if republishing impacts behaviour then.

Web form is a little odd. When you conditionally make a thing required, it shows the red "required" appearance. It has been this way for a while now. I do agree that it seems odd as that deviates from standard behaviour though. While in the Field App though, the "required" fields behave as expected.

0 Kudos
Teresa_Blader
Frequent Contributor

I accidentally marked this as a solution! 

Unfortunately, upgrading was not the answer. I think I'll have to put in an Esri ticket. If you cleared out a bunch of questions it's likely something in there that's causing the chaos. 

Thanks for testing for me to at least weed out something!! Appreciate it.

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

Unless there is a hyper-specific bug in the Web App, I can't think of what would impact that behaviour beyond what I was seeing. Hopefully Esri can track down the issue.

That said, have you tried narrowing down the cause? If you just put a few of the offending fields into their own survey, you theoretically should be able to recreate this behaviour on a smaller scale, which would help with troubleshooting.

0 Kudos
Teresa_Blader
Frequent Contributor

So, I see some of the require conditions respected when I remove the esri:visible conditional statements off the main page 2 group. However, I left a different conditional statement under esri:visible on a sub group on the page and those were not respected. So it seems related to this esri:visible field and how it acts in the web form. Or I'm bad a writing completely correct conditional statements.

esri:visible allows calculations to happen even if the visible condition is not met - which I need for a question in the first sub group on page 2. Relevant does not run the calculations if it is not relevant.

What is so confounding is why esri:visible would force something to be required even if it doesn't meet the required condition.

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