Questions tagged [javascript]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
23 views

How to add JavaScript to an AJAX snippet

I need to customize the fields of a form inside a dialog popup from within an extention. The common form hooks obviously don't work here because I can't address code that's loaded dynamically. Is ...
Jan's user avatar
  • 145
0 votes
1 answer
21 views

How to add custom JavaScript globally?

How do I add custom JavaScript to an extention so it appears on all pages?
Jan's user avatar
  • 145
0 votes
0 answers
22 views

civi api response limit working in postman but not in javascript

I created a postman test with api4 of civicrm. It adds to the body as x-www-form-urlencoded: key: params value: {"limit": 5} This works fine and returns only 5 results. I tried to do the ...
Gesko's user avatar
  • 11
1 vote
1 answer
34 views

Contact Quick Edit, refreshParent after CRM.api3('CustomValue', 'create)?

Stuck with jQuery, which intercepts a contact Quick Edit and updates a custom field. All is fine and a value gets updated in the database but is not immediately shown, need to click "Edit" ...
yurg's user avatar
  • 2,005
2 votes
3 answers
80 views

Custom javascript file is not refreshed

I embedded a JavaScript file inside a custom extension via the buildForm hook. The file gets loaded and does its job, however it is not reloaded reliably after an update. When I upload a new version ...
Jan's user avatar
  • 145
0 votes
1 answer
23 views

Event config page suddenly not working

This evening, I was working on adding a few custom fields to a profile we're using for an event. Finished up, tested, all was well. I went to take my test registration off the event and check that ...
BubbaWanders's user avatar
0 votes
0 answers
9 views

contribution page loop with js errors

WP 6.03 civi 5.52 payment processor is OmniPay - Eway_RapidShared Had been working fine - have removed all recent plugins & disabled wordfence, all caches cleared after clicking contribute the ...
LesleyJill's user avatar
0 votes
0 answers
24 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 ...
zach's user avatar
  • 315
3 votes
1 answer
47 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 ...
zach's user avatar
  • 315
0 votes
1 answer
41 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 ...
Jude Hungerford's user avatar
3 votes
1 answer
1k 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 ...
david123456789's user avatar
1 vote
1 answer
47 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) ...
dading84's user avatar
  • 145
0 votes
1 answer
284 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 ...
Stephen Palmstrom's user avatar
0 votes
1 answer
16 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')....
commonpike's user avatar
  • 1,181
1 vote
2 answers
59 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()...
Interlated's user avatar
1 vote
0 answers
38 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 ...
Ozsvar's user avatar
  • 11
0 votes
0 answers
44 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 ...
TIAPL's user avatar
  • 11
0 votes
2 answers
62 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 ...
dsmith63's user avatar
  • 419
1 vote
1 answer
143 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 ...
Akshay Kamble's user avatar
2 votes
1 answer
61 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 ...
William Mortada's user avatar
2 votes
2 answers
56 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....
MikeSteigerwald's user avatar
0 votes
1 answer
21 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 ...
Mike Steigerwald's user avatar
1 vote
0 answers
24 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) ...
Aidan's user avatar
  • 13.5k
4 votes
1 answer
90 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 ...
Alan Dixon's user avatar
  • 6,841
1 vote
0 answers
137 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 ...
Harald Balluch's user avatar
0 votes
3 answers
179 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 ...
Tish's user avatar
  • 83
0 votes
1 answer
65 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
Giles Forde's user avatar
2 votes
1 answer
75 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 ...
vvvp's user avatar
  • 21
1 vote
0 answers
28 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 "...
calbasi's user avatar
  • 81
1 vote
0 answers
29 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....
deepak's user avatar
  • 197
1 vote
0 answers
28 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 ...
Wayne Watson's user avatar
1 vote
2 answers
37 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 ...
Interlated's user avatar
1 vote
2 answers
42 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 ...
user3016811's user avatar
2 votes
2 answers
187 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 ...
RayWright's user avatar
  • 2,488
2 votes
0 answers
256 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 ...
Alec Macleod's user avatar
2 votes
2 answers
196 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 ...
stijn's user avatar
  • 139
2 votes
2 answers
274 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', { ...
Mike Steigerwald's user avatar
5 votes
2 answers
392 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 ...
ITSupport ERELOS's user avatar
1 vote
1 answer
31 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/...
GrannyKat's user avatar
  • 493
1 vote
1 answer
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 ...
Andrew Thompson's user avatar
3 votes
2 answers
102 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 ...
Zachary's user avatar
  • 1,777
1 vote
1 answer
81 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 ...
RayWright's user avatar
  • 2,488
1 vote
1 answer
88 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 ...
ermSO's user avatar
  • 189
1 vote
1 answer
190 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 ...
Jannis Eicker's user avatar
1 vote
2 answers
121 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 ...
John Richardson's user avatar
1 vote
1 answer
92 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 ...
AlainB's user avatar
  • 542
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 ...
Sean's user avatar
  • 3,168
1 vote
0 answers
18 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 ...
Sean's user avatar
  • 3,168
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 ...
ManiMuthuPandi's user avatar
1 vote
1 answer
271 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. ...
Stephen Palmstrom's user avatar