I'm trying to use [cb:if] statements to show/hide a custom html field if text fields [cb_...] are filled in by users.
So far, I've got:
Code:
<div>
[cb:if cb_suburb="" and cb_state="" and cb_country=""/] [/cb:if]
[cb:if cb_suburb!="" and cb_state="" and cb_country=""/]<i class="fa fa-home fa-lg"></i>1 [cb_suburb][/cb:if]
[cb:if cb_suburb="" and cb_state=!"" and cb_country=""/]<i class="fa fa-home fa-lg"></i>2 [cb_state][/cb:if]
[cb:if cb_suburb="" and cb_state="" and cb_country!=""/]<i class="fa fa-home fa-lg"></i>3 [cb_country][/cb:if]
...
</div>
When the fields are all empty (ie. none have been filled in), this results in a |home| icon with a 2. I've tried it with 2 different custom fields and sets of text input fields and got the same result both times.
Any ideas why this doesn't work or is there a better way to hide the custom html field when the text fields are all empty? As far as I understand, the conditional plugin does not allow for AND statements.
Your usage seams fine except for a minor error in one of the substitutions. Specifically the below.
[cb:if cb_suburb="" and cb_state=!"" and cb_country=""/]<i class="fa fa-home fa-lg"></i>2 [cb_state][/cb:if]
The operator on cb_state is set to =!, but it should be !=.
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.
The following user(s) said Thank You: nant, davisJ