Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3
votes
1answer
35 views

How to set ckeditor text with javascript

Is it possible to set ckeditor text with javascript for a custom field? I want to do something similar to the mail templates selection. I try $('#custom_162_126').val('blub') but this only change the ...
1
vote
1answer
24 views

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

I have noticed that there is a field called 'javascript' in the 'price_sets' table in the CiviCRM database. The comments associated with this field are: 'Optional Javascript script function(s) ...
0
votes
1answer
52 views

Has anyone got a recent example of a REST client under Drupal 9, possibly using AJAX?

I am trying to work out a way of presenting contact information from CiviCRM to another server, but am struggling to work out how one would code it. Has anyone got an example of something that works ...
0
votes
1answer
9 views

Member reports javascript broken after update

Somewhere between 5.15 and 5.36, javascript starts breaking on all member reports. In the html body, javascript is searching for $originalElement = $dateElement.siblings('#membership_join_date_from')....
0
votes
1answer
17 views

How do I load javascript only on pages with CiviCRM loaded on them?

I'm trying to load a civicrm function. What is the recommended way to load 'CRM' checking that it is available on the page first? CRM.$(function ($) { 'use strict'; ... addObserverFormErrors()...
1
vote
0answers
9 views

Where can I find CRM javascript object?

I want to use CRM.api3('Email', 'create', { ... call in my javascript. But the object CRM doesn't exist on my website. Which js file do I need to load to access that CRM object? I thought I'd load it ...
0
votes
0answers
33 views

Javascript error from Expenses extension : https://lab.civicrm.org/extensions/expenses

Currently using CiviCRM Version 5.31 (Wordpress Version 5.5.3) Network error appears when I click on Edit Expense or Delete Expense. I tried the instructions listed on this website (Below link) and ...
0
votes
1answer
27 views

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

If I create a new page and include this shortcode, the Civi User Dashboard displays correctly. [civicrm component="user-dashboard"] If I create a new page but nest the same short code ...
1
vote
1answer
32 views

Wordpress Civicrm -Uncaught ReferenceError: CRM is not defined for contribution page

WordPress - 5.4.4 , CiviCRM - 2.62 , Theme Avada Using shortcode added contribution to page but in console, we are getting error Uncaught ReferenceError: CRM is not defined so the page is not ...
2
votes
1answer
38 views

Why does CRM.url give different results in WordPress and Drupal?

I'm trying to understand why the JavaScript function CRM.url gives different results depending on CMS. Can anyone explain? For example this code: CRM.url('civicrm/payment/ipn/test', null, 'front') In ...
2
votes
2answers
33 views

How to get all active states & provinces from one api call?

I would like to get all active (i.e., in countryLimit) states & provinces available in my site for use in HTML tag. Can I query for that with a single JavaScript call to CRM.api3? I've tried: CRM....
0
votes
0answers
52 views

Can't install CiviCRM package on nuxt.js

i'm trying to install the Javascript Node-CiviCRM package with npm in my Nuxt.js project with no luck. I tried: npm install civicrm --save but i have the following issues: npm WARN deprecated request@...
0
votes
1answer
14 views

How best to use crmApi result within angularJs controller?

Referring to the snippet below, how do I get the controller function (DashboardController) to 'wait' for the return from crmApi? I've debugged enough to know crmApi returns the results I like, but ...
1
vote
0answers
19 views

How can I load javascript dependencies in a tab?

I have a page that works correctly when loaded directly, but fails when loaded as a tab. The page includes: CRM_Core_Resources::singleton() ->addScriptUrl('https://d3js.org/d3.v5.min.js', 10) ...
4
votes
1answer
57 views

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

I'm trying to debug a Drupal/CiviCRM integration issue where js/css resources that are added in an extension are not getting output. I think it should get output as part of a form snippet that's ...
1
vote
0answers
65 views

Civicrm on Drupal: broken JS and CSS or Asset Caching enabled

If I enable asset caching in CiviCRM everything works fine. If I disable it, the administration menu is gone from the top to a list that's beneath the page content and a lot of JS is broken too. The ...
0
votes
3answers
120 views

Nothing happens on selection of “Actions” dropdown options

Can someone offer me some insight as to the possible cause of the Actions drop-down not working? Here is my setup: CiviCRM 5.13.3 Drupal 7.67 PHP 7.2.16 Bootstrap subtheme set to use JQuery 3.1 ...
0
votes
1answer
45 views

Accessing fields/data from a lookup field

Does anyone here know about CRM? Accessing lookup field data (composite address field) using JavaScript? Lookup field is on Contact form. Trying to access address of Account entity
2
votes
1answer
67 views

Could not establish connection

I am using CiviCRM for 6 months now and suddenly, since a couple of weeks when I try to enter or change an address I get a pop up saying "Netwerkfout Geen verbinding met de server. Ververs deze pagina ...
1
vote
0answers
24 views

CKeditor extrange behavior: UI settings are only saved partially, and defaults load every time

I can not, for example, hide a button (spelling for example) using CKeditor settings: /civicrm/admin/setting/preferences/display?reset=1 If I hide it, I can see how it's hiding at the moment at the "...
1
vote
0answers
24 views

Assigning a php associative array to JS?

I am trying to assign a php array to js. // On the Server: CRM_Core_Resources::singleton()->addVars('myNamespace', array('foo' => 'bar')); // In the JS file or inline script CRM.alert(CRM....
1
vote
0answers
24 views

Post upgrade to 5.8, Javascripts running in Drupal are failing with CRM is not defined

Both on drupal blocks where references to CRM.$ are used and in custom javascripts that call CRM.api3, the scripts are failing and displaying an Uncaught Exception: CRM is not defined. Everything ...
1
vote
2answers
29 views

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

The requirement is that if someone picks a complimentary part of the event they have to select a paid part. I have updated with jquery the rule so that if someone checks a free option the ...
1
vote
2answers
35 views

Correct method for API calls on contact summary page? (slow!)

I pull out some important at-a-glance information on contact summary pages - membership info, relationships via related cases, etc. At the moment i override contentsummary.tpl and do my API calls ...
2
votes
2answers
165 views

Jquery not affecting custom fields of an activity

I have written some jquery (inside an extra template file) that does some simple show/hiding of custom fields in an activity based on user selections. We use it as a helpful tool for users to select ...
2
votes
0answers
164 views

How do you select a value of an EntityRef Select2 using jQuery?

I have a scenario where a user selects a row of data to edit and I want an EntityRef Select2 box to be populated with a piece of information from that row. The EntityRef select2 widget works for ...
2
votes
2answers
154 views

status page not loading nor new mailing page

so I get this error in console JQMIGRATE: Migrate is installed, version 1.4.1 jquery-migrate.min.js:2:542 SyntaxError: expected expression, got '<'[Learn More] en_US:1 Error: CRM.url called before ...
2
votes
2answers
169 views

How to update contact email with JavaScript API?

I'm trying to update a contact and, especially, the email address. As far as I can tell using the API explorer, this is the correct JavaScript code for that: crmApi('Contact', 'create', { ...
5
votes
2answers
309 views

Wordpress Ajax & pictures not loading after upgrade to 5.0

I've updated from 4.7.29 to 5.0.0 The SQL update went well, but I've issues with JS/Pictures not loading. This is really blocking as for example, the "Create new contact" is not loading See ...
1
vote
1answer
26 views

Scripts not running in contribution pages

Contribution page loads slowly and is missing the field for "total amount" . Viewing in console indicates that all scripts fail to load because the path references source path of https://xxxURL.xxx/...
1
vote
0answers
2k views

How to modify a custom field DataTable (sorting and appearance) from an extension?

I am having difficulty customising the display of a DataTable for a contact custom field group (multiple-record tab). I am trying to write an extension that would use a bit of JavaScript to interact ...
3
votes
2answers
76 views

Civicontribute radiobuttons without “none”, where the “Other” contribution field deselects radiobuttons

This is a Theming/UI question for CiviCRM. I've done some theming to turn the radiobutton's into clickable options. When I select an amount it updates the 'Regular Amount' field. However, when I ...
1
vote
1answer
73 views

Javascript Contact API - how do I 'do something' with results

Through javascript, I was hoping to check what groups a user belongs to and then use that information to show / hide something. I can't use ACLs because I'd like the average internal user to be able ...
1
vote
1answer
67 views

API URL needs administrator

I am writing an extension which uses a CRM.api3 call in javascript on the contribution page. However, the link that is generated is lacking the "administrator" part. For example, The API call to ...
1
vote
1answer
149 views

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

As you can see in the picture below, icons do not show. They are missing on all pages, also on buttons. This does not change after emptying cache and rebuilding the menu. I've also checked the ...
1
vote
2answers
104 views

How can I configure my contribution page so that recurring is not pre-selected by default?

Obviously, I want to provide the option for recurring but I do not want it to load the page with default recurring selected. I think this is the way most administrators would want it to work. Should ...
1
vote
1answer
82 views

Fill in custom field of type contact reference field from javascript returns TypeError

I have a custom field, which is a contact reference field. Based on what the user fills in on the form, I would like to fill in the contact reference field with a specific contact. Leaving the user ...
2
votes
1answer
2k views

How can I trigger a selection for a Select2 EntityRef element via javascript?

The CiviCRM EntityRef form element uses a Select2 select box to make lots of CiviCRM forms more awesome. A user can, for example, search for contacts to choose one. Great. I am building an extension ...
1
vote
0answers
13 views

Which javascript features can I use in CiviCRM core?

Does CiviCRM have an agreed-upon browser version to target for javascript features? For example: Can I use Object.create() (IE 9+)? Can I use 'use strict'; (IE 10+)? Can I use let (IE 11+)? Can I ...
0
votes
1answer
6k views

Javascript MIME type mismatch error after server move

I have moved the installed civicrm with Drupal from windows PC to Linux PC and changed the civicrm settings file. Everything working fine but only the javascript files are not loading. The resource ...
1
vote
1answer
263 views

Ajax error when viewing relationships under IIS and Joomla (HTTP400 - invalid syntax)

This is similar to Ajax Error when trying to view relationships tab, but the analysis is different. It is not solved by increasing the request limits - they are much higher than the GET parameter. ...
1
vote
1answer
907 views

DataTables warning with dedupe on find & merge (after upgrade to 4.7.18)

Is anyone else seeing a new DataTables warning in 4.7.18? We get the following warning on the dedupe page when finding duplicate contacts: [Server Name] says: DataTables warning: table id=...
1
vote
2answers
211 views

Getting CiviCRM resources to load on the Joomla frontend

I have created an Event in CiviCRM and it all worsk fine in the Administrator side of Joomla when I test the Online Registration page. I have a price set of various ticket prices and the total adds up ...
1
vote
3answers
254 views

Backbone javascript conflict causing Configure Event / Repeat to fail

Problem with a Civi 4.7 installation on WordPress 4.7.2 -- due to other complications involving Backbone, we are NOT running JetPack. I found a related question in CiviEvent 4.7.7 Issue with ...
1
vote
1answer
326 views

JavaScript Errors / CRM.$ is not a function

After updating CiviCRM to the latest 4.6, I have been experiencing various Javascript errors. For example, on a contribution page: (notice the CRM.$ function is defined after the page is loaded) I'...
1
vote
2answers
42 views

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

I've just upgraded a Civi 4.6.18 install to 4.7.15. All has gone fairly smoothly, apart from the fact that the CiviCRM front page/dashboard is broken. My Firebug console reports: "TypeError: widget....
2
votes
1answer
149 views

Issue where soft-credits will not save

We've been having this issue over at least one major upgrade where certain types of soft-credits just will not save, without leaving any type record in the error logs. Crediting an individual from ...
3
votes
1answer
426 views

Getting a Custom Field Value on a Contact with Javascript API

I have a custom field for contacts that I would like to retrieve the value for using JavaScript. Using the API explorer I have generated the code that does this. It works PERFECTLY from the API ...
6
votes
1answer
91 views

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

Specifically -> I'd like to see what's in the Membership Tab -> Inline instead. I'd like that table with Active Memberships printed right at the top underneath the Display Name on civicrm/contact/view?...
1
vote
2answers
192 views

Unable to create a new mailing

I am editing this question to provide more information. I am running CiviCRM 4.7.8 with WordPress 4.5.3. We are using php 5.6.23. When selecting "New Mailing" from the "Mailings" menu, the screen is ...