Hot answers tagged

6

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 the profile, was incorrect, and included a reference to an admin URL for a script, which wouldn't be accessible to non-logged in site visitors. Removing it ...


4

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.$. Passing a function straight into jQuery is an alias of calling jQuery(document).ready() (not one that we made up, it's a jQuery thing). The argument your function ...


4

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 need to redefine the css for them on your custom file.


3

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 throwing an error, but it is not logged to the Civicrm log nor the Drupal log. I was able to solve this by increasing the query string length in IIS. In IIS ...


3

Check your civicrm.settings.php and check also the settings under adminster --> system settings --> resource urls In the latter you can force civicrm to load css/js via https


3

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 such thing as a 'default' site. The quickest way to determine if this is your problem is to visit the CiviCRM dashboard and check the browser console for a 404 ...


3

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 example, the relationship form has this in its post-process function: $this->ajaxResponse['reloadBlocks'] = array('#crm-contactinfo-content'); Which has the ...


3

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.


3

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 initialize CiviCRM, after which you can make API calls. Since booting the CRM adds overhead, it's best to only do when CRM is required - hence the separate function.


3

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 payment form is loaded. The value of the total amount defaults to 1.0 instead of considering the delimiter configured for your site, i.e, 1,0. Either this might ...


3

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 your question, some of the other permissions might still restrict undesired actions, but among other things it gives access to the REST api (via civicrm/ajax/...


2

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 this site. I switched the client's Drupal user ID to use the custom theme, and now AJAX refreshes correctly. So, it appears Drupal Garland theme specific.


2

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 Dashboard?" option. Save the report. Go back to the CiviCRM dashboard, click the configure button, and add your report.


2

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 your server setup (question says just Apache which typically suggests via mod_php) you probably need to increase either the number of connections Apache permits. ...


2

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.$('document').ready(function($) { The function receives jQuery as it's param, so now we have access to jQuery as the familiar $ for use in our code. Also ...


2

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 would like to give a step-by-step of how I worked it out. In your Javascript console (press F12 in your browser, then "Console" tab) you'll see a bunch of ...


2

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 showed these errors: Failed to load resource: the server responded with a status of 403 (Forbidden) https://www.xxxxxx.com/civicrm/ajax/...


2

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 calls directly - see classes like CRM_Contact_Page_AjaxTest CRM_Custom_Page_AJAXTest CRM_Financial_Page_AjaxTest CRM_Group_Page_AjaxTest


2

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+yourself+up+to+work+with+Selenium+tests Include a line that waits for some element you are expecting to appear, then test its value using the webtest api.


2

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


2

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 Postcode on the form and you need to populate address line of the postcode before submission then you need to write AJAX to fetch the records from Database Links for ...


2

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

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 without language code. In my case, the function returns civicrm_group instead of civicrm_group_fr_FR. Then, the function CRM_Core_DAO_AllCoreTables::...


2

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 involve granting more permissions than users ought to have, take a look at https://docs.civicrm.org/dev/en/master/hooks/hook_civicrm_alterAPIPermissions/."


2

crmLoad is triggered on every action. Try: CRM.$(document).on('crmLoad', function(e, data) { console.log(data); })


2

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: Multilingual mode is activated on your CiviCRM site. Error in the browser console show files not found at a path with the word "undefined" in it. Also, "DB Error: no ...


2

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 the value of one field based on the value of another fields. For (1), arbitrary lists, you can look into hook_civicrm_fieldOptions, which can dynamically modify ...


2

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 parsed the data back into the CiviCRM form using Jquery. Thanks


2

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($field) && $field == 'mycustomfield_123') { $myArray = [ 1 => 'Title 1', 2 => 'Title 2' ]; $options = $myArray; ...


1

I have tested the above issue against WP 4.6.1 and CiviCRM 4.7.11. I am running Apache 2.4, php 5.6 and MySQL 5.6. The OS is CentOS 6. I cannot reproduce this error nor the one mentioned Ajax Error when trying to view relationships tab I commented in https://issues.civicrm.org/jira/browse/CRM-19331 about this as well. I would suspect the issue here is ...


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