Solved

Hide Controls Based based on Choice

  • 26 October 2021
  • 4 replies
  • 445 views

Hi All, Hopefully a simple one for the experts (I am new in town). I have a form with a choice drop down. I have a hidden panel which appears if a certain choice is selected i.e. if contains "X". What i cannot achieve is making it appear if contains "X" or "Y"? Any ideas guys? Thanks, Andy.

icon

Best answer by allan 26 October 2021, 17:29

View original

4 replies

Userlevel 4
Badge +9

You want to make make it appear if
MyChoice == 'X' || MyChoice =='Y' 

So you need to hide it when : 
not(MyChoice == 'X' || MyChoice =='Y' )
which is equal to :
MyChoice != 'X' && MyChoice !='Y' 

|| means "or" and && means "and"

Hi Allan,
Thanks for the reply. I really am a novice at this.
At present the below "almost" works, panel appears when 'Unclassified' is selected. I also need said panel to appear if 'Private' is selected.
!contains(Classification,"Unclassified")
Userlevel 4
Badge +9

Let's think it that way : In which case do you want to panel to appear ?
When creating a rule, you specify when to hide controls. Hiding is just the opposite of displaying.

You want your panel to be displayed when Classification=='Unclassified' or when Classification=='Private'
--> 


 


Classification=='Unclassified' || Classification=='Private'

 



So the opposite of that is : 


 


NOT(Classification=='Unclassified' || Classification=='Private')

 



That would be your rule.
Do not forget your "empty" case. What should happen if nothing is selected ?
So I suspect your rule would be 


 


NOT(Classification=='Unclassified' || Classification=='Private') || isNullOrEmpty(Classification)

 

Thanks so much Allan, that's nailed it.

Reply