2

Wordpress with CiviCRM 5.3.2

Hi guys, I'm struggling with a small problem.
I've added a tab (using tabset) to create a new tab while viewing a contact. That tab lists any dogs registered to that particular person. I've added an 'edit' and 'delete' link to the far right of the listing and all of that works. I wrote a quickform that opens when the 'edit' link is clicked. I can update the dog's information, click submit and it does update the entity in the database. The issue is, how do I tell the parent of this edit popup to refresh? The change I've made in the edit is not reflected in the listing until I reload the page manually.
I've read in a lot of places of some ways of doing it but I haven't figured out WHERE to initiate it. In particular there is a CRM.refreshParent and/or the crmPopupFormSuccess. I don't know where I would put these? I used civix to create the basic form, then made modifications to the php file to do a preprocess and postprocess, of which does the update, etc.
So, how and where do I tell the parent page to refresh when I close the popup of the form? Some direction would be appreciated.

Norm

  • unrelated to your question, how did you go about creating the quickform and template? Did you build a new extension (civix, etc)? If not, what files need to be created and how are they called? I've done custom tabs and popups (no extensions, just using the hook as you did), but always calling standard Civi forms. I would like to create a custom form of my own and not sure what's the best method these days (not sure I want to create a whole new extension just for one small form). Thanks. – Paul B Apr 19 at 17:42
  • Sorry for the late response. It was all done with coding in the extension. It was not that difficult once you understand the format of the files. – Norm Dressler May 23 at 17:09
0

There should be a .tpl template file that goes along with your .php file. You can put the javascript in that file.

The files created for your form via civix and their locations are described here: https://docs.civicrm.org/dev/en/latest/extensions/civix/#generate-form

  • Well, I sort of made it work with $this->preventAjaxSubmit(); in my php file for the form, but that reloads the entire page, not just the calling page. Better than leaving old information there though. I will look at putting that Javascript into the tpl file. Thanks – Norm Dressler Nov 11 '18 at 20:18
0

Solved my issue with the code snippet which is mentioned here - https://docs.civicrm.org/dev/en/latest/framework/ajax/ called CRM.livePage.js. I added it to my tpl file as suggested above and it now refreshes the tab I'm on!

Thanks Norm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.