Hot answers tagged

6 votes

"SyntaxError: Unexpected token" error on l10n-js files

Finally located the source of the problem. Every page on the site included a widget in the footer using an HTML snippet for a CiviCRM sign-up form. The HTML snippet, despite being the one generated by ...
  • 3,713
4 votes
Accepted

How to insert Javascript into an inline form edit via an extension?

cj(function ($) {}) has an implicit document.ready. To unpack that dense few characters of code: cj is the deprecated alias of CiviCRM's copy of jQuery. In 4.5 and above use the new one: CRM.$. ...
  • 16.3k
4 votes
Accepted

Mixed content error on SSL site

Check your CIVICRM_UF_BASEURL value in civicrm.settings.php and check also the settings under Administer --> System Settings --> Resource URLs. In the latter you can force civicrm to load css/js ...
4 votes
Accepted

How to load custom css into admin popup boxes?

The custom css file do load on every page of civicrm, even the pop ups. Note that the elements in the ajax contains different ids and classes(mostly starts from ui-**) compare to page view. So you ...
3 votes

Ajax Error when trying to view relationships tab

I had the same issue. CiviCRM 4.7/Drupal 7/IIS8 configuration. The Ajax call was generating a query longer than what the web server was configured to handle and behind the scenes the web server was ...
3 votes
Accepted

Quick search icon spins forever after upgrading from 4.4 to 4.5

Since you're using multi-site Drupal, check the Image Upload URL in Civi to be sure it's not set to https://[domain]/sites/default/files/civicrm/persist/contribute/. In a multi-site setup there is no ...
  • 2,808
3 votes
Accepted

Can I update/requery a custom field that got changed via another field on the same page?

The contact summary screen is divided into different panes, and they are each refreshed separately. If a popup form needs to refresh one or more panes, it can specify them by jQuery selector. For ...
  • 16.3k
3 votes
Accepted

activity dashlet not showing results

Yes, go try creating an activity on someone's record and assigning it to yourself. If it doesn't show up in the dashlet, you have a problem, because that's what the dashlet is for.
  • 7,367
3 votes

Using Civicrm_api3 in onAjax[Name] plugin function

Call civicrm_initialize() before using civicrm_api3() (or other CiviCRM functions). This function is defined in the various CMS plugins (eg civicrm.module) and will load required files then ...
3 votes
Accepted

Problem with incoerent local currency in contribution

Looks like the decimal delimiter present at civicrm/admin/setting/localization?reset=1 is configured as a comma (,) instead of a default .. Civi might not be handling this correctly when the record ...
3 votes
Accepted

What are the security considerations before allowing access AJAX API to anonymous users?

Is the visibility for your field defined in the profile as Expose Publicly and also with the Searchable checkbox checked? You might not have to fiddle with permissions. Otherwise to directly answer ...
  • 18.8k
3 votes

Making a small application with the CiviCRM API

I think what you're looking for is either https://docs.civicrm.org/dev/en/latest/api/v4/usage/#ajax, or the rest api at https://docs.civicrm.org/dev/en/latest/api/v3/rest/ Api explorer, found at https:...
  • 18.8k
2 votes
Accepted

Upgrade from 4.5.8 to 4.6.2 killed View Contact Tabs

Aaahhhh!!!! I just noticed that this client's Drupal user ID was set to view the site with the default Garland theme whereas my Drupal user ID was set to view the site with the custom theme built for ...
2 votes

activity dashlet not showing results

It sounds like what you are wanting is to create a dashlet from the activity report. Go to Reports > Contact Reports > Activity Set up your report with the columns you wish Check the "Available for ...
  • 16.3k
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 ...
2 votes
Accepted

How do I partially hide Ajax supplied content?

Please see the Civi JavaScript reference , specially this: CRM.$(function($) { // Your code here }); Remember that CRM.$ is our alias of jQuery. So the first line is shorthand notation for CRM.$...
  • 2,301
2 votes

"SyntaxError: Unexpected token" error on l10n-js files

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 ...
2 votes

Ajax Error when trying to view relationships tab

I am seeing this on 4.6.14 . This is due to modsec thinking it is a SQL attack. I saw a popup indicating datatables saw an error and to look here:https://datatables.net/manual/tech-notes/7 Console ...
2 votes
Accepted

How to write unit tests for methods thsat echo instead of return (e.g., AJAX call handlers)

Allan - I have tended to try to refactor the AJAX functions such that they call a more testable function & test that - this generally improves the code.... There are a few examples that test the ...
  • 96
2 votes

How to write unit tests for methods thsat echo instead of return (e.g., AJAX call handlers)

I'm a bit out of date on the current status of the civi test framework, but if WebTests are still available I would do this as a WebTest. https://wiki.civicrm.org/confluence/display/CRM/Setting+...
  • 18.8k
2 votes
Accepted

Suppress default CRM.alert in hook_postProcess

To clear all status messages and prevent them from being shown to the user, you can do: CRM_Core_Session::getStatus(TRUE);
  • 16.3k
2 votes

Tutorial for creating pages with ajax

As far as I know - If you dont need any specific action to be done on the form which you have created before you hit the submit button then you should be alright For example: If you enter a ...
2 votes

HowTo: crmApi get rows with date between

Oh, I've found in my crm menu Support - Develper - API Explorer and there was a solution: start_date: {'BETWEEN': ['2015-01-01', '2016-01-01']},
2 votes

After upgrade to 4.7.13, I get 500 Internal Server Error when creating new mailing

After investigations : The issue is due to i18n : if multilingual is on, then the bug raises. When it's off, there are no bug. CRM_Core_DAO_AllCoreTables::registerEntityType returns only table names ...
2 votes

AJAX API permissions

I believe there is currently a bug. I have submitted a bug report: https://issues.civicrm.org/jira/browse/CRM-20582 When I ran into my issue, I was told: "If you need a quick fix that doesn't ...
2 votes
Accepted

https://docs.civicrm.org/dev/en/latest/framework/ajax/

crmLoad is triggered on every action. Try: CRM.$(document).on('crmLoad', function(e, data) { console.log(data); })
  • 1,272
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: ...
2 votes

Fetch Node data from drupal into CiviCRM

On which forms do you wish to add the fields/logic? I feel like there are two questions here: 1) How to build an arbitrary list of options from a third-party source of data (Drupal) 2) How to set ...
  • 3,171
2 votes
Accepted

Fetch Node data from drupal into CiviCRM

I wasn't able to figure this out so data is Fetched directly into CiviCRM. However, I ended up using Drupal EntityQuery and fetched the data into a webform then Used Javascript PopUp Feature and ...
  • 521
2 votes
Accepted

Using fieldOptions with Custom Fields

As I haven't seen your code, I can only suggest what worked for me: function myext_civicrm_fieldOptions($entity, $field, &$options, $params) { if ($entity == 'Contribution') { if (isset($...

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