Skip to Content Skip to Menu

[SOLVED] Reload entire profile if one specific AJAX field changed

  • sysopcrew
  • sysopcrew
  • OFFLINE
  • Posts: 74
  • Thanks: 14
  • Karma: 3
6 years 6 months ago - 6 years 6 months ago #303368 by sysopcrew
I can't figure out the appropriate Auto Action setup to get the full profile to reload if one particular Ajax field is updated. Since Conditional doesn't work on Ajax updates on a profile page (just on Edit and Registration pages), I need to completely reload the profile page: a yes/no radio button to trigger the display of a file upload field.

If I try a Redirect Auto Action or a Code Auto Action with PHP header("Location: /profile"), the reloaded profile page appears in the Ajax field area, not the full page. How can you reload the parent page, not the Ajax field content?

First, the displayed field in the Profile:


Then, you select the radio button and Update:


But then the Auto Action redirect loads the redirect URL into the Ajax field area (this is the edge of the main logo on the top of the site, now in the Ajax field display area):


I thought I'd try to output a <meta http-equiv="refresh" content="0">, but that doesn't seem to get output.

Trigger = onAfterUserUpdate

It seemed easiest to detect the Ajax field submitted by using PHP:
Code:
if(array_key_exists('cb_my_field',$_POST)) { header('Location: /profile?tab=48'); }

--
David Riviera
Attachments:
Last edit: 6 years 6 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: 48444
  • Thanks: 8279
  • Karma: 1443
6 years 6 months ago - 6 years 6 months ago #303370 by krileon
You'll need to use a Code action with Method set to jQuery and bind to the CB Core Fields Ajax event fired when a field is updated on the after profile display trigger. See the below for example jQuery.

Code:
$( '#cbfr_FIELD_ID_HERE' ).on( 'cbajaxfield.save.success', function() { // CODE HERE });


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.
Last edit: 6 years 6 months ago by krileon.
The following user(s) said Thank You: sysopcrew

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

  • sysopcrew
  • sysopcrew
  • OFFLINE
  • Posts: 74
  • Thanks: 14
  • Karma: 3
6 years 6 months ago #303463 by sysopcrew
Got it! Thanks. The onAfterUserProfileDisplay trigger and the numerical ID... works like a charm.

--
David Riviera
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