CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • api call from popup
Pages: [1]

Author Topic: api call from popup  (Read 420 times)

dlats

  • I post occasionally
  • **
  • Posts: 77
  • Karma: 0
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7.12
  • MySQL version: 5.0.91
  • PHP version: 5.2.17
api call from popup
October 23, 2014, 01:09:41 pm
I have written an api call and use it on the new case form. I added the hook_civicrm_alterAPIPermissions. Using the menu Cases->New Case, it works as expected. Using the contact summary->actions->New Case, the form is displayed in a popup and the api call is never made. The call is made from js that is added via a module using drupal_add_js(). The call is

CRM.api("Dog", "get", {"sequential": 1, "type": "all", "dog_name":cj("#type_dog_name").val()}

The js is being added to the form that displays in the popup (other functions work).

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: api call from popup
October 23, 2014, 01:18:43 pm
See "Javascript in Smarty Templates" here:
http://wiki.civicrm.org/confluence/display/CRMDOC/Javascript+Reference#JavascriptReference-LegacyIssues
Try asking your question on the new CiviCRM help site.

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: api call from popup
October 23, 2014, 01:24:26 pm
The easiest solution is probably to add a .tpl.extra file and add the code inline per above.
OR, Instead of dumping all the code into the extra tpl it could be just 1 line long with a <script src=...> tag to reference your js file.
Try asking your question on the new CiviCRM help site.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • api call from popup

This forum was archived on 2017-11-26.