Dynamic populate Query Field on Query Drop Down (Single)

4 years 6 months ago - 4 years 6 months ago #314585 by nancy.aharpour
Hi,
in the Profile View of a user, I need to pass the value of Query Drop Down Single to a Query Field but I cannot.

Where I'm wrong?

the Query Filed as a query like that:

SELECT * FROM `#__comprofiler_views` WHERE (`viewer_id` = '[cb_my_dropdown]' OR `profile_id` = '[cb_my_dropdown]')

that should return all the records with user_id passed by [cb_my_dropdown].

on the Query Field I've set:

CB Core Field Ajax --> Update On cb_my_dropdown

but this doesn't work...

Any Helps?

Thanks
nancy

Please Log in to join the conversation.

4 years 6 months ago #314596 by krileon
You need a Query Select field to refresh its display when another fields value changes (should work) or your need a Query field to refresh its display when a Query Select field refreshes its display (may not work)? Sorry, not following how your fields are chained together.


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 #314605 by nancy.aharpour
Yes you're right I didn't explain to you all my scenario.

My scenario is this

I want to create a Query Field with this query:

SELECT a.*, b.firstname, b.lastname, c.username FROM `#__comprofiler_views` AS a
LEFT JOIN `#__comprofiler` AS b ON b.id = a.profile_id
LEFT JOIN `#__users` AS c ON c.id = a.viewer_id
WHERE `profile_id` [ here goes the user_id from a select drop down]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I want that a Query Drop Down Field passes a user_id selected by the user in the front end to this query

how can I do it?

I read your article

www.joomlapolis.com/documentation/345-cb-query-field/tutorials/18533-configuring-dynamic-usa-state-city-zip-fields-with-cb-query-field-plugin

but this passes dynamically variable between two or more Drop Down Query Field, I need to pass a variable from 1 - Drop Down Query Field --> to Query Field

Thank
Nancy

Please Log in to join the conversation.

4 years 6 months ago #314623 by krileon
That'll work fine, but the problem is profile edit will suppress empty fields. So if the query field is initially empty on profile edit display then the field won't display at all for it to ajax update. You can work around this by adding to the layout to force it to output something at all times using the below.

Profile Edit Value Layout
<div>[value]</div>

This should ensure the query field always displays on profile edit even if it's empty. Next just be sure to configure the Update On under Integrations > CB Core Fields Ajax for that same query field and it should refresh its display when the dependent fields value changes. I've confirmed the works using the following.

Query:
SELECT `username` FROM `#__users` WHERE `id` = '[FIELD_NAME]'
Output: Single Row
Columns: Single Column
Update On: FIELD_NAME

This will display the username matching the user id from FIELD_NAME for example.


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

Moderators: beatnantkrileon
Time to create page: 0.220 seconds

Facebook Twitter LinkedIn