Skip to Content Skip to Menu

Filtering a query field with a dropdown on the profile view without editing??

  • ddesbiens
  • ddesbiens
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
7 years 3 months ago #295550 by ddesbiens
so i made a query field that gets info from the database for hockey match results and i'd like for the users to filter the results based on a months dropdown list directly on the profile.
i could create a code field with the list but then i'm not sure how to pass the dropdown value to the query field. Any insight on the best way to proceed would be greatly appreciated.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8280
  • Karma: 1443
7 years 3 months ago #295570 by krileon
You want a query field to update its results when the dropdown value changes? Yes, that's doable but only in profile edit or registration. This is done using the "Update On" functionality in CB Core Fields Ajax by having the query field update when the dropdown field changes (you'd select the dropdown field in the update on of the query 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 or Create an account to join the conversation.

  • ddesbiens
  • ddesbiens
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
7 years 3 months ago - 7 years 3 months ago #295576 by ddesbiens
well so far i got the following code which creates my dropdown and when i select a new month it reloads the page on the correct tab.
I created a query field that get the correct information based on a text field with the month number in it.

The only thing i'm missing is to update the month text field in the data base before i reload the page:

Any insight would be appreciated:

File Attachment:

File Name: code.txt
File Size:2 KB
Attachments:
Last edit: 7 years 3 months ago by ddesbiens. Reason: code tag not working

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

  • ddesbiens
  • ddesbiens
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
7 years 3 months ago #295577 by ddesbiens
You most likely already have a function somewhere for the ajax field that i can call up instead building my own ... which would be better to use for update purposes and security. i'm guessing something like this would work with the correct info filled in :

function performAjaxUpdate() {
$.ajax({
url: 'test.php',
method: 'POST',
data: {
action: 'save',
field: $("#db_field").val(),
val: $("#db_value").attr()
},
dataType:'json',
success: function(data) {
alert(data.success);
}
});
return false;
}

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48444
  • Thanks: 8280
  • Karma: 1443
7 years 3 months ago #295587 by krileon
I don't understand what you're trying to do. Why are you building a dropdown with PHP? Your dropdown values are static so a standard select field should be sufficient. If you need dropdown values from PHP you can use CB Code Field and its Code Select fieldtype. If you want to be able to edit the field from profile view with ajax you can use CB Core Fields Ajax for that (see Integrations > CB Core Fields Ajax parameters while editing your select 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 or Create an account to join the conversation.

  • ddesbiens
  • ddesbiens
  • OFFLINE
  • Posts: 5
  • Thanks: 0
  • Karma: 0
7 years 3 months ago #295621 by ddesbiens
Well what i want to do is to add a dropdown FILTER to display hockey montly stats (and i'll mostly a year/season filter too) in the profile view.(Yes i could have tried a dropdown with cbajax but it felt convoluted on the profile view.)

i have a cb query that gets the corrects stats based on a month variable (a simple text field as of now)

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

Moderators: beatnantkrileon
Powered by Kunena Forum