Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
16 views

Can you create a select menu that contains all values in a certain column?

Is there a way in afform/Form Builder to create a select menu that contains all values in a specified column? An example would be First Name. I know that afform offers search fields, but these are ...
  • 303
3 votes
1 answer
35 views

Horizontal scroll bar on searchkit/afform

We have been using SearchKit and Form Builer (afform) to develop new reports for our teams. Some of the tables have grown to be quite extensive. The headers are becoming difficult to read because the ...
  • 303
0 votes
1 answer
24 views

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

We would like to be able to pre-fill the price or "other amount" in a Civi payment page based on the querystring parameters. I have tried creating an extension which adds some Javascript to ...
3 votes
1 answer
219 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
1 answer
37 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) ...
  • 135
0 votes
1 answer
145 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
1 answer
13 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')....
  • 1,159
0 votes
1 answer
36 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
0 answers
23 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 ...
  • 11
0 votes
0 answers
40 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 ...
  • 11
0 votes
2 answers
58 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 ...
  • 387
1 vote
1 answer
83 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
1 answer
49 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
2 answers
38 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
1 answer
19 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
0 answers
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) ...
  • 11.4k
4 votes
1 answer
78 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 ...
  • 6,153
1 vote
0 answers
94 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
3 answers
148 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 ...
  • 83
0 votes
1 answer
59 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
1 answer
71 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 ...
  • 21
1 vote
0 answers
25 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 "...
  • 81
1 vote
0 answers
26 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....
  • 197
1 vote
0 answers
25 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
2 answers
33 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
2 answers
36 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
2 answers
176 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,426
2 votes
0 answers
200 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
2 answers
169 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 ...
  • 139
2 votes
2 answers
206 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
2 answers
350 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
1 answer
30 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/...
  • 473
1 vote
0 answers
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
2 answers
90 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,723
1 vote
1 answer
78 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 ...
  • 2,426
1 vote
1 answer
74 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 ...
  • 189
1 vote
1 answer
172 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
2 answers
120 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
1 answer
89 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 ...
  • 492
2 votes
1 answer
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 ...
  • 3,148
1 vote
0 answers
16 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 ...
  • 3,148
0 votes
1 answer
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
1 answer
265 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
1 answer
912 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,222
1 vote
2 answers
213 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 ...
  • 105
1 vote
3 answers
276 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 ...
  • 594
1 vote
1 answer
368 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'...
  • 138
1 vote
2 answers
43 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....
  • 3,723
2 votes
1 answer
150 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 ...
  • 353
3 votes
1 answer
468 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 ...
  • 1,146