Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

CB Conditional - show/hide fields

  • azjr
  • azjr
  • OFFLINE
  • Posts: 99
  • Thanks: 10
  • Karma: 2
9 years 1 month ago #270018 by azjr
CB Conditional - show/hide fields was created by azjr
Please advise:
1) dropdown field with values 1,2,3
2) description fields (desc1,desc2,desc3)

Goal:
a) if value is empty: hide all description fields
b) if value is 1: show desc1 (don't show 2 and 3)
c) if value is 2: show desc1 and desc2 (don't show 3)
d) if value is 3: show all desc1,2 and 3

~~~
so I set the conditional on dropdown filed:
display: field conditional others
in tab 1: operator = empty
then fields:
show (nothing)
hide: desc1,desc2,desc3

in tab 2: operator = 1
then fields: show desc1
hide: desc2,desc3

in tab 3: operator = 2
then fields: show desc1, desc2
hide: desc3

in tab 4: operator = 3
then fields: show desc1, desc2, desc3
hide: (nothing)

~~~
results: only when selecting 3 desc1,2,3 shows up - when selecting 1 or 2, or nothing, nothing is displayed
How do I fix it?
thanks

Please Log in or Create an account to join the conversation.

  • azjr
  • azjr
  • OFFLINE
  • Posts: 99
  • Thanks: 10
  • Karma: 2
9 years 1 month ago #270019 by azjr
Replied by azjr on topic CB Conditional - show/hide fields
I think I answered that question for myself already :)
instead of using conditions on dropdown field (as to others) I should be using the conditions on individual fields (desc1,2,3) as to self and hide if value is greater than or equal (value)
ex: to show desc 1 = the value is greater than or equal 1; desc2 = greater or equal 2, etc.

~~~
devil's advocate question: can my initial logic work? to apply all conditions in one field instead of individual conditions on each? (f you have i.e. group of fields (let say 3 or more) for each case, than it could be easier=faster? to do that in one place... - just a thought)

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48466
  • Thanks: 8280
  • Karma: 1443
9 years 1 month ago #270086 by krileon
Replied by krileon on topic CB Conditional - show/hide fields
Conditional Others or Tab Conditions are the way to go for mass conditioning multiple fields. The "gotcha" is a field can only be conditioned once, ever. If you condition a field more than once then only the last condition applied matters. There is currently no AND/OR logic implemented (it's planned) and all conditions act independent of one another. So in your case you really will want to use Conditional Self based off your A > B > C structure using Is REGEX with a REGEXP or the greater than or equal to usage.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum