Generating warning message in Survey 123 to detect wrong drop down choice selected by user

1036
6
Jump to solution
12-13-2022 09:51 AM
Shubhreet
New Contributor III

Hello,

I am creating a survey to map open beds in the Personal care homes (PCHs). The survey will be using static locations of the PCHs. I linked data from a .csv file into the survey media folder which contains data such as prime contact name, prime contact email, and facility location (latitude, longitude). To fill out the survey to map open beds within the PCHs, the users will need to choose name of the PCH from a drop down question and in the next question they will need to enter the number of open beds.

I want to incorporate an error check system (via warning message) into my survey  which will detect if the user is choosing the right PCH from the drop down. In other words, I do not want any user to choose the wrong PCH and enter data on his/her behalf. Through the .csv file each user's email ID is already linked to the survey which could also be retrieved automatically when a user fills in the survey (using same email ID in my case since the survey is available only to the licensed users). I am trying to create a warning message check to detect and pop out a warning message when the user's email (submitter email) is not same as the his/her .csv linked email (Prime contact email). Pleas note that the submitter's email question is a calculated one via pulldata("@property","email") which automatically pulls the email of the licensed user when he/she fills the survey. 

Please refer the screenshot below:

Shubhreet_0-1670953548317.png

The code in bind::esri:warning is not working. Could anyone please suggest the right code/process to accomplish this? 

0 Kudos
4 Solutions

Accepted Solutions
DougBrowning
MVP Esteemed Contributor

Warnings are only for GeoPoint questions only for now.  See here  https://community.esri.com/t5/arcgis-survey123-questions/does-warning-message-work-on-dates/m-p/8783...

I thought there was an idea on this but I cant find it.

View solution in original post

0 Kudos
NickGIS
New Contributor II

You can display a note as a warning message using the following steps:

Create a new field with type: note with 'name' e.g. warning_message.

Then give this a 'label' <p style="color:red;">WARNING MESSAGE</p>

Use the 'hint' field if you would like to add more info to your warning message.

Put your conditional (string(${submitter_emial})!=string(${prime_contact_email})) statement in the 'Relevant' field instead. Be sure that your submitter_email and prime_contact_email have default values that are not equal, so that the field is shown by deafult.

View solution in original post

0 Kudos
DougBrowning
MVP Esteemed Contributor

You can add a or field != '' or string-length > 0 or != 0 to the relevant.  So basically make sure it is also not blank for the warning to fire.

View solution in original post

0 Kudos
Shubhreet
New Contributor III

Thank you so much @DougBrowning . Your solution worked. 

View solution in original post

6 Replies
DougBrowning
MVP Esteemed Contributor

Warnings are only for GeoPoint questions only for now.  See here  https://community.esri.com/t5/arcgis-survey123-questions/does-warning-message-work-on-dates/m-p/8783...

I thought there was an idea on this but I cant find it.

0 Kudos
NickGIS
New Contributor II

You can display a note as a warning message using the following steps:

Create a new field with type: note with 'name' e.g. warning_message.

Then give this a 'label' <p style="color:red;">WARNING MESSAGE</p>

Use the 'hint' field if you would like to add more info to your warning message.

Put your conditional (string(${submitter_emial})!=string(${prime_contact_email})) statement in the 'Relevant' field instead. Be sure that your submitter_email and prime_contact_email have default values that are not equal, so that the field is shown by deafult.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Sorry should have said that Samples of the warnings you mention and using instant emojis is linked in my post above also.

Emoji.gif

 

0 Kudos
Shubhreet
New Contributor III

Thank you @DougBrowning and @NickGIS for the quick replies and your suggestions. I have used warning message as a note as suggested but the warning message is now present on the from by default. Even if i just open the survey form I can see the warning message even when there is nothing pulled from the prime contact email field. Is there way to execute the warning note only when the user  chooses the PCH from drop down and the prime contact email gets pulled to match against the submitter's email?

 

Shubhreet_0-1671039634805.png

 

0 Kudos
DougBrowning
MVP Esteemed Contributor

You can add a or field != '' or string-length > 0 or != 0 to the relevant.  So basically make sure it is also not blank for the warning to fire.

0 Kudos
Shubhreet
New Contributor III

Thank you so much @DougBrowning . Your solution worked.