Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

Help for writing a Query

  • ducky13
  • ducky13
  • OFFLINE
  • Posts: 15
  • Thanks: 3
  • Karma: 0
2 years 3 weeks ago #331417 by ducky13
Help for writing a Query was created by ducky13
Hi there at JoomlaPolis,
I have 2 simultaneous problem.
Problem 1
I already have a Dropdown single select field (let's say Field 1) with 10 values.
For some reasons I would like now to add another field (field 2) using specificly only 2 of the 10 previous values. So I would like to automatically populated these values in field 2 from the field 1.
I guess that CB Query function could help, but unfortunately I am not into that kind of thing  .
Mostly this query should say : if Field 1 got value "x" or value "y" then get this value for Field 2.

Problem 2
Because I want this new field 2 being serachable, I would like to have this field as "Dropdown single select" with the 2 values above mentionned.
Is this possibility compatible with my first request ?

Thanks a lot in anticipation for your anser.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48555
  • Thanks: 8292
  • Karma: 1445
2 years 3 weeks ago #331421 by krileon
Replied by krileon on topic Help for writing a Query
You want to dynamically set the dropdown options of Field 2 based off what's selected in Field 1? Yes that's doable with either CB Query Field or CB Code Field either using a Query Select or a Code Select. In your case it's probably best to just use a Code Select and do this with PHP so you don't need to hit the database for information already available since it's user data. Your PHP would basically check if Field 1 contains X value then add Y to an array and return that array.

As for helping with the coding we do not provide coding assistance outside of our Business Membership .


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