Skip to Content Skip to Menu

[SOLVED] How to chain ajax fields on profile display

  • activha
  • activha
  • ONLINE
  • Posts: 2327
  • Thanks: 117
  • Karma: 13
4 years 5 months ago - 4 years 5 months ago #318233 by activha
Hello

We have a query dropdown field changed by ajax working fine and another CB Code field querying another table depending on the first field value.

What we want to achieve is to have an ajax automatic update of the second field on the profile when the first one is updated by ajax.

I tried different settings on chaining ajax fields but nothing seems to work to update automatically. After a page reload, everything is fine though, but that defeats the purpose of ajax updating the first field

Do you have another suggestion ?

Thanks
Jean
Last edit: 4 years 5 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
4 years 5 months ago #318236 by krileon
Replied by krileon on topic How to chain ajax fields on profile display
Update On does not apply to profile view. It only works in profile edit and registration as the description of the parameter explains. There is no functionality for refreshing a field that isn't being edited in profile view. If you want to allow both to be ajax edited as a group in profile field then in Field A select Field B in "Additional Fields" and both fields will be ajax editable (including Update On behavior) when clicking Field A.


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.

  • activha
  • activha
  • ONLINE
  • Posts: 2327
  • Thanks: 117
  • Karma: 13
4 years 5 months ago #318237 by activha
Replied by activha on topic How to chain ajax fields on profile display
I tried it and the second field B is not editable.
I guess that it's normal as it's a CB Code field getting the result upon the first one line this
Code:
global $_CB_database; $_CB_database->setQuery( "SELECT * FROM `#__groupjive_plugin_events` WHERE `id` = " . (int) '[cb_marketevents]' ); $event = $_CB_database->loadAssoc(); if($event) {$eventname = ( (in_array( 18, \CBLib\Application\Application::User( (int) $event['user_id'] )->getAuthorisedGroups()) && ($event['group'] != 56)) ? (int) CBuser::getUserDataInstance( (int) $event['user_id'] )->get( 'cb_marketing_multiplier' ) . ' €' : '(2 €)' );} //else $eventname = \CBLib\Language\CBTxt::T('UE_SET_CAMPAIGN'); echo $eventname;

That worked well as you suggested in another post for a json url that we query with native applications. But this time we would like it to display in the user profile and I cannot get it to work.

Do you have a suggestion ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48435
  • Thanks: 8275
  • Karma: 1443
4 years 5 months ago #318247 by krileon
Replied by krileon on topic How to chain ajax fields on profile display
Code fields can be displayed in profile edit assuming your install is up to date as that was implemented. Simply set its field to display in profile edit. You should then be able to use Update On with it. Verify Update On is working in profile edit then retry with ajax and the "Additional Fields" behavior. I've reopened the Update On usage in profile view ticket to reconsider implementing it for a later release.

Aside from that the best I can suggest is move your code field to a tab in a not shown on profile position then just add your code field to the layout parameters of your cb_marketevents field so their display is always grouped. That should cause it to always output correctly when cb_marketevents changes via ajax.


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.

  • activha
  • activha
  • ONLINE
  • Posts: 2327
  • Thanks: 117
  • Karma: 13
4 years 5 months ago #318248 by activha
Replied by activha on topic How to chain ajax fields on profile display
Wonderful !!
I didn’t even thought at layouts !j
Work like a charm, thank you again
The following user(s) said Thank You: krileon

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

Moderators: beatnantkrileon
Powered by Kunena Forum