Questions tagged [javascript]
The javascript tag has no usage guidance.
87
questions
0
votes
0
answers
11
views
How to resolve a Javascript error on Event setup?
This is a fairly longstanding problem on a D7/Civi site that I'd love to sort out. The site runs a lot of events using CiviCRM. The Online Registration tab for event configuration should present a ...
1
vote
1
answer
26
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 ...
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?
0
votes
0
answers
28
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 ...
1
vote
1
answer
36
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" ...
2
votes
3
answers
94
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 ...
0
votes
1
answer
26
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 ...
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 ...
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 ...
3
votes
1
answer
49
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 ...
0
votes
1
answer
43
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
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 ...
1
vote
1
answer
50
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
1
answer
313
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
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')....
1
vote
2
answers
68
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
39
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
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 ...
0
votes
2
answers
63
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
1
answer
170
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
66
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
62
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
23
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
28
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
1
answer
100
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
0
answers
142
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
182
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
1
answer
70
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
76
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
0
answers
29
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
0
answers
35
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
0
answers
33
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
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 ...
1
vote
2
answers
43
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
195
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
0
answers
260
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
201
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
2
answers
280
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
399
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
34
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
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 ...
3
votes
2
answers
104
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
1
answer
83
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
1
answer
89
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
1
answer
194
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
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 ...
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 ...
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 ...
1
vote
0
answers
20
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
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 ...