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*

make "Query Drop Down (Single Select)" searchable

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
5 years 7 months ago #311591 by carin
My Query Drop Down (Single Select) has over 10.000 entries. Therefore I need a "type ahead" or "instant search" functionality on that field. What is the best way? Could I use selectize?

CB 2.0

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
5 years 7 months ago #311604 by krileon
You can have a text field displayed before it then in your query used in your query select substitute in the text field to filter by it. Next use the Update On feature provided by CB Core Fields Ajax so your query select field refreshes itself when your text field changes.


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

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

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
5 years 7 months ago #311621 by carin
Thanks. But that means the user has to first type in one field, then click on another field to see if the amount of typed letters decreased the amount of options far enough and if not click in the text field again back to the keyboard and type again, then click in the drop down again to see how many items are now in the list if still too many click in the text field again keep typing ... that is a UI from the 80ies. Is there no JS solution like selectize? Surely I am not the first one facing this problem.

CB 2.0

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
5 years 7 months ago #311625 by krileon
No, there is no JS solution. You need ajax endpoints for a JS solution. The UI can be improved by using CSS and moving things around. Best I can suggest is use a Text field with the new Auto Complete feature provided by CB Code Field and CB Query Field plugins as shown below.

www.joomlapolis.com/blog/kyle/18831-cb-code-field-2-0-0

This maybe expanded in the future to work with select2 JS dropdowns to act as an endpoint for select2 search results.


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.

  • carin
  • carin
  • OFFLINE
  • Posts: 417
  • Thanks: 18
  • Karma: 0
4 years 9 months ago - 4 years 9 months ago #316743 by carin
Thanks, got it working with the additional text field. Some problems remain:

1. How do I make sure the query for the select field does not run on page load but only on text field change?
2. How do I make sure the select field only updates when at least 3 chars are entered in the text field?
3. How do I make sure the select field contains max. 10 entries?

CB 2.0
Last edit: 4 years 9 months ago by carin.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 9 months ago #316751 by krileon
You're able to have what you're wanting now via the Autocomplete feature. Both CB Query Field and CB Code Field provide Autocomplete now for text fields. This would still allow free form editing of the field though since it's a text field.

1. How do I make sure the query for the select field does not run on page load but only on text field change?

Ensure your query has the appropriate filters in it to limit its result set when no text field value exists. You could even surround the query with an IF substitution checking if the text field has a value so it won't query unless text field value is supplied for example.

2. How do I make sure the select field only updates when at least 3 chars are entered in the text field?

I assume you mean with the Update On functionality provided by CB Core Fields Ajax; you can't. There's no feature to limit length. You could add such a limitation to your query field I suppose again using an IF substitution, but with a regexp operator to check if it has at least 3 characters.

3. How do I make sure the select field contains max. 10 entries?/quote]
Add a LIMIT statement to your SQL in your query select.



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