Change Apperance based on a conditional statement

598
3
Jump to solution
12-06-2022 07:06 AM
JuanEsquivel
New Contributor

I am trying to change the appearance field based on a conditional statement. For example, if selected(${more_users},"no") then set the appearance to hidden, else set it to the default value. aside from that I don't know if placing that statement on the appearance field is correct. If not please guide me.

 

This is what I came up with, not sure if I'm on the right path.

if(${more_users} = "Yes", "", "hidden")

2 Solutions

Accepted Solutions
abureaux
MVP Regular Contributor

What you are looking for is the relevant or body::esri::visible fields. Just put your statement in one of those two fields.

E.g., if(selected(${more_users},'Yes'), 'yes', '')

 

Edit. Forgot to give a general explanation of the difference between these fields.

FieldGeneral explanation
Relevant

While hidden, a field ceases to exist.

E.g., User input will disappear and reset to default. Also, a field hidden by 'relevant' that is required will be ignored when submitting.

body::esri::visible

While hidden, the field still exists.

E.g., User input will be maintained. A field hidden by 'body::esri::visible' that is required must contain data.

 

View solution in original post

DougBrowning
MVP Esteemed Contributor

Actually you need a true statement, you do not use yes as the return.  Just selected(${more_users},'Yes') does the trick.  yes is just for the user drop down but it is any true or false statement.  Using yes or '' does not always work.

View solution in original post

0 Kudos
3 Replies
abureaux
MVP Regular Contributor

What you are looking for is the relevant or body::esri::visible fields. Just put your statement in one of those two fields.

E.g., if(selected(${more_users},'Yes'), 'yes', '')

 

Edit. Forgot to give a general explanation of the difference between these fields.

FieldGeneral explanation
Relevant

While hidden, a field ceases to exist.

E.g., User input will disappear and reset to default. Also, a field hidden by 'relevant' that is required will be ignored when submitting.

body::esri::visible

While hidden, the field still exists.

E.g., User input will be maintained. A field hidden by 'body::esri::visible' that is required must contain data.

 

DougBrowning
MVP Esteemed Contributor

Actually you need a true statement, you do not use yes as the return.  Just selected(${more_users},'Yes') does the trick.  yes is just for the user drop down but it is any true or false statement.  Using yes or '' does not always work.

0 Kudos
abureaux
MVP Regular Contributor

Right. I usually just copy-paste IF statements around because they work in more than one type of field.

It hasn't been my experience for this to fail. Do you have a specific scenario, or just something you have seen from time-to-time?

0 Kudos