[SOLVED] Query fields dependancy question (country - state)

4 years 6 months ago - 4 years 6 months ago #314822 by liaskas
Registration process. No user yet.

Table name "country_info"


2 Fields:

a) cb_country
We use this query: SELECT DISTINCT `country` FROM `country_info` ORDER BY country
Everything shows fine! No problem to select the country.


b) cb_state
Here we need to show all states of the selected country in the previous field. So we try like this:
SELECT DISTINCT `state` FROM `country_info` WHERE `country` = '[cb_country]' ORDER BY state
No way...
The pull down field is empty.

If we change the (`country` = '[cb_country]') part of the query with (`country` = 'Andorra') for example... the field works and shows the Andorra states. So we believe that there is something wrong with the '[cb_country]' part.


Can you please advise?

Thank you in advance...
Attachments:

Please Log in to join the conversation.

4 years 6 months ago #314837 by krileon
You need to have CB Core Fields Ajax installed then under Integrations > CB Core Fields Ajax of your State field select your Country field for Update On. This will cause the state field to refresh when Country changes and will result in your substitution working based off your current selected country.


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 to join the conversation.

4 years 6 months ago #314849 by liaskas
Forgive me i forgot to mention.

CB Core Fields Ajax is already installed and set but the result is no choices inside the states pull down menu.

Attachments:

Please Log in to join the conversation.

4 years 6 months ago #314855 by krileon
Is this during profile edit or registration? frontend or backend? Ensure CB Core Fields Ajax it self is public and published in CB > Plugin Management. Ensure within CB > Configuration > User Profile that "Profile View Access Level" is set to something your users can actually access as it can block ajax endpoints. You should see a loader icon appear next to the State field when your change the value of your Country field.


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 to join the conversation.

4 years 6 months ago #314864 by liaskas

Is this during profile edit or registration? frontend or backend?

Registration, Frontend

Ensure CB Core Fields Ajax it self is public and published in CB > Plugin Management.

Published and public!

Ensure within CB > Configuration > User Profile that "Profile View Access Level" is set to something your users can actually access as it can block ajax endpoints.

We are talking about the Registration process. No profile yet to have "Profile View Access Level"

You should see a loader icon appear next to the State field when your change the value of your Country field.

No... no loader shows when changing Country field.

What i see is this...
Before country select...


After country select...
Attachments:

Please Log in to join the conversation.

4 years 6 months ago #314867 by krileon
Please PM backend super administrator login credentials and will take a look. Some reason the jQuery is failing to function or load to perform the ajax call.


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 to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.196 seconds

Facebook Twitter LinkedIn