6 votes
Accepted

CiviCRM Ajax API - Searching by Tag

you are almost there: instead of using the tag name, use the tag id (eg 5 for Volunteers) CRM.api3('Contact', 'get', { "debug": 1, "sequential": 1, "return": ["tag"], "tag": "5" }).done(...
user avatar
  • 10.1k
5 votes
Accepted

How to go about making a Core Tab on the Contact Summary screen view Inline instead?

Rather than smarty, JavaScript will do the trick. Those tabs are all separate pages, and you can load any CiviCRM page/form as a snippet instead. First, in your extension, use a hook to include the ...
user avatar
  • 7,357
4 votes
Accepted

How to update contact email with JavaScript API?

There are many ways you can update email for contact Using Email api with create action CRM.api3('Email', 'create', {"email": "aaa@asas.comsdsd", "id": 201}).done(function(result) { // do something}...
user avatar
3 votes
Accepted

Getting a Custom Field Value on a Contact with Javascript API

The syntax is incorrect - and I just confirmed that the syntax generated by the API Explorer for Getvalue is incorrect, so you're not to blame! The culprit is this line: "return": ["custom_102"], ...
user avatar
3 votes

Unable to create a new mailing

Found the problem. Debugging was turned on. Once I turned it off "New Mailing" worked.
user avatar
3 votes

How to get contact id of logged-in user in JS API

In case of an angular page use something like function myext_civicrm_angularModules(&$angularModule) { [...] $session =& CRM_Core_Session::singleton(); drupal_add_js(array('...
user avatar
  • 1,272
3 votes
Accepted

Drupal's Aggregate Javascript breaks CKEditor Config

You're right, that was a bug. I poked around and found a spot for the js that doesn't break under aggregation: https://github.com/civicrm/civicrm-core/pull/7711
user avatar
  • 16.2k
3 votes

Upgraded to 4.6 Civicrm javascript errors Error can't send email or press some buttons

issues.civicrm.org is down right now - but I see this issue: CRM-12570 "Javascript error when mootools is loaded in Joomla backend". I'll also note that everyone reporting this problem is using ...
user avatar
3 votes
Accepted

Moving Angular extension into /ang/

Here's the detailed steps I took to move the angular extension from an extension and into core. if your angular files are not already name spaced, they should be changed. In the angularextension ...
user avatar
  • 91
3 votes

How can I resolve Civi Dashboard Javascript error: widget.name is null?

I'm glad you found the cause of your problem. It does sound like something went wrong back when you originally created those dashlets, and it's not clear what that was. But it would be good to ...
user avatar
  • 16.2k
3 votes

JavaScript Errors / CRM.$ is not a function

Figured it out after some troubleshooting. On the Drupal theme being used, the minified JS (including jQuery) was being put at the end of the page and not present when Civi JS is executed.
user avatar
  • 138
3 votes
Accepted

Jquery not affecting custom fields of an activity

In some CiviCRM pages/forms custom fields are loaded/reloaded via AJAX (you will notice that if you have a set of custom fields based on Activity type, the custom fields update/reload when changing ...
user avatar
  • 2,301
3 votes
Accepted

How to pre-fill price or "other amount" from the querystring in payment pages

Below code should work if you have amount parameter set in the url for example amount=300&id=10&reset=1 jQuery(document).ready(function() { let amount = new URLSearchParams(window.location....
user avatar
2 votes
Accepted

Is Civi having a separate copy of jQuery inefficient?

I wrote a Drupal module to do just that! https://www.drupal.org/project/civi_jquery It allows Drupal and CiviCRM to share the same copy of jQuery, and resolves redundant plugins so the browser has a ...
user avatar
  • 16.2k
2 votes
Accepted

How to disable datepicker UI for a mobile device

To use the native datepicker of the mobile device, the field needs to have type="date". So your code to disable the datepicker popup and use the native device's instead might look like: (function($) {...
user avatar
  • 16.2k
2 votes

Dashboard hangs; forces apache restart

You are experiencing CRM-16035 - Dashlet refresh can crash server. The default dashboard config is pretty close to maxing out the default Debian config for either Apache or PHP-FPM. Depending on ...
user avatar
2 votes

hide select box options in contributed page

First - don't edit anything in the templates_c directory! These are cached pre-compiled copies of the template, and are frequently cleared out. Second - it's not advisable to edit the templates that ...
user avatar
2 votes

How to get contact id of logged-in user in JS API

For a Javascript-only solution, you can also make an API call using user_contact_id for the contact ID. For instance: $result = civicrm_api3('Contact', 'get', [ 'sequential' => 1, 'return' =&...
user avatar
2 votes
Accepted

Javascript MIME type mismatch error after server move

The X-Content-Type-Options: nosniff header is a security measure that prevents the browser from attempting to detect the MIME type of a download automatically, as this behavior can be exploited for ...
user avatar
  • 1,870
2 votes
Accepted

After upgrade to 4.7.23., icons do not show (Civicrm on WordPress) (SOLVED)

Following my comment - You need to provide existing path in the resource url and directories page. Click the help icon to see the values of diferent global variables that you can make use of(civicrm....
user avatar
2 votes
Accepted

Civicontribute radiobuttons without "none", where the "Other" contribution field deselects radiobuttons

This code worked for me: CRM.$(function($) { $('input[type=text]', '#priceset').on('keyup', function() { if ($(this).val()) { $('input[type=radio]:checked', '#priceset').prop('checked', ...
user avatar
  • 16.2k
2 votes

Wordpress Ajax & pictures not loading after upgrade to 5.0

I can see the problem (I saw this myself recently), but I don't have a 100% answer. However, the solution is usually to rebuild your multilingual schema. This problem is characterized by: ...
user avatar
2 votes

status page not loading nor new mailing page

Generically: You have a Javascript error, so I would definitely consult the Troubleshoot Javascript errors post which describes additional steps to try. That said - I know what your problem is, and ...
user avatar
2 votes

Jquery not affecting custom fields of an activity

Ok What's happening is this. If you look at your .crm-accordion-header css rules in an Inspector window in your browser, you will see there is a background-color !important rule earlier in the CSS ...
user avatar
2 votes
Accepted

How do I trigger a price calculation update on the event registration page?

Here's how we do it: We do the two sets of items in a separate price field on the same price set. So the paid options that are required would be in one field, the complementary in another (or several ...
user avatar
2 votes

Where in the CiviCRM codebase do css and js resources get output for an AJAX url or snippet?

I haven't found the answer to this question, but I can avoid it instead. These functions: CRM_Core_Resources::singleton()->addScriptUrl() CRM_Core_Resources::singleton()->addScriptFile() ...
user avatar
  • 5,994
2 votes

Why does nesting Civi shortcodes in Wordpress pages prevent Javascript files from loading?

https://developer.wordpress.org/reference/functions/get_shortcode_regex/ "get_shortcode_regex" doesn't seem to work when nesting CiviCRM shortcodes. I found 2 hacky workarounds.
user avatar
  • 355
2 votes
Accepted

How do I use the javascript field in the price_sets table of the database

I don't see any evidence that that field was ever used for anything. If you want to insert javascript into the page see https://docs.civicrm.org/dev/en/latest/framework/resources/#javascript which you ...
user avatar
  • 17.9k
2 votes
Accepted

How to set ckeditor text with javascript

Use the CKEditor method setData(): CKEDITOR.instances['custom_162_126'].setData('blub');
user avatar
1 vote
Accepted

How can I resolve Civi Dashboard Javascript error: widget.name is null?

Also in the database in the 'url' column I see the url of the dashlet in the form: civicrm/report/instance/42?reset=1&section=2&snippet=5&context=dashlet and comparing entries with data in ...
user avatar
  • 3,664

Only top scored, non community-wiki answers of a minimum length are eligible