[SOLVED] Conditional Fields

6 years 11 months ago - 6 years 11 months ago #294655 by highonryan
[SOLVED] Conditional Fields was created by highonryan
I have two fields, Phone Number USA/Canada (cb_phone) and Phone Number World (cb_phoneworld).

I am trying to set up a conditional to hide the cb_phoneworld field when someone selects United States or Canada from a dropdown populated by #__comprofiler_countries or hide cb_phone when someone selects any other country but United States or Canada

I have tried both Field Conditional Others (on the Country Dropdown cb_country) and Field Conditional Self (on cb_phone).

I can get it working for just one country at a time.

With Field Conditional Self on cb_phone:
I set CB Conditional 1 to Equal to United States Show, 2 to Equal to Canada Show, 3 Not Equal to United States Hide, 4 Not Equal to Canada Hide

With Field Conditional Other on cb_country I am doing the same, except, I chose show cb_phone and hide cb_phoneworld in 1 for United States and 2 for Canada

These works for the United States but not Canada.

Is there a way to make a field conditional for either one of two countries, and not the rest?

Thanks,
HighOnRyan

Please Log in to join the conversation.

6 years 11 months ago #294662 by krileon
Replied by krileon on topic Conditional Fields
You can not condition the same field twice. Since you're only needing to check if a field has either/or value then you can use regexp condition to check for that. Example as follows.

Field: cb_country
Operator: Is REGEX
Value: /United States|Canada/


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: highonryan

Please Log in to join the conversation.

6 years 11 months ago #294680 by highonryan
Replied by highonryan on topic Conditional Fields
Great!

Once again a perfect solution and a quick answer!
The following user(s) said Thank You: krileon

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.193 seconds

Facebook Twitter LinkedIn