Hot answers tagged

5

Ok, I found the way. It's just passing an array of option values to 'val' argument: $('#my_select2').select2('val', ["value1", "value2", "value3"]);


4

The case custom fields are formatted as a series of one row tables. You could add some jQuery to move them around. For example: CRM.$(function($) { $('#Outcomes table:nth-of-type(3n+1)').each(function (index) { // Combine 3 rows into 1 for (var i = 0; i <= 1; i++) { $(this).find('td:last').after($(this).next().find('td')); $(...


3

I think you can set something in postProcess hook to reload the tabs possibly below code but not sure, it does work for us when we update something in a form we update the contribution tab using below code $form->ajaxResponse['updateTabs']['#tab_contribute'] = 1; HTH Pradeep


3

That first error, "SyntaxError: expected expression, got "<" suggests that something in WordPress - a poorly behaving theme or plugin - is injecting text on every page load. That'll screw up CiviCRM. I would troubleshoot this by switching to one of the core themes (e.g. twentyseventeen) and disabling plugins (ideally on a test site if this site is ...


3

You cannot always predict the id or name for custom field for an activity, it is either custom_385_14(incase of saved custom field for activity where 14 is id from custom value table) or custom_385_-1 incase of new one. I always follow below snippet to work incase of custom field and it does call my change event when i change option from select dropdown. I ...


2

It looks like this was a bug in CiviCRM. I have written a fix and submitted a pull-request for review. Your testing and feedback can help expedite the review process to get it accepted into the codebase. https://github.com/civicrm/civicrm-core/pull/12312


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

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

Are they in the administrators group? Since then you might be able to do something like (untested): CRM.api3('GroupContact', 'get', { "contact_id": "user_contact_id", // use this exact string to mean current user "group_id": "Administrators" }).then(function(result) { if (result.count == 0) { // Not in the admin group // ** do your removal ...


2

This code worked for me: CRM.$(function($) { $('input[type=text]', '#priceset').on('keyup', function() { if ($(this).val()) { $('input[type=radio]:checked', '#priceset').prop('checked', false).each(function() { calculateRadioLineItemValue(this); }); calculateText(this); } }); $('input[type=radio]', '#priceset').on('...


2

I would use calculateTotalFee() to check if total amount is > 0. CRM_Core_Resources::singleton()->addScript(" CRM.$(function($) { hideshowMainProfile(); $('#priceset [price]').bind('change keyup click blur', hideshowMainProfile); function hideshowMainProfile() { if (calculateTotalFee() > 0) { $('.crm-public-form-item.crm-...


2

So to enhance on the answer from Pradeep, here is what I have done: function myextension_civicrm_postProcess($formName, &$form) { if ($form instanceof CRM_Contact_Form_Inline_Email) { $form->ajaxResponse['updateTabs']['#tab_custom_32'] = 1; } } Where the 32 is the ID of my custom group, so I will obviously change that so it will retrieve the ...


1

Never mind - all working now. I modified the CiviCRM Resource URL from the default that was in there of [civicrm.root] to be the full URL http://example.com/wp-content/plugins/civicrm/civicrm and the choice of 'Choose Date Range' showed up in the drop down giving the functionality needed. Or it is entirely possible that Choose Date Range was there the whole ...


1

You can use the Stripe element events to trigger something - see https://stripe.com/docs/js/element/events We do that in the Stripe extension here: https://lab.civicrm.org/extensions/stripe/-/blob/master/js/civicrm_stripe.js#L281 There are some useful CiviCRM/Stripe extension events which help with frontend integrations and we are open to adding more: ...


1

The issue is with the intervention library used, which doesn't support animated GIFs. The intervention bug is 5+ years old. While intervention is open source, the maintainer is mostly inactive, and hasn't released the source code of his new version, which he's been working on for years. I think it might be time to remove intervention from Mosaico. Note ...


1

Did you find an answer to your question? It seems that the platform does not accept the .gif format. Admin support and I figured it out... kinda: It works if you use the "traditional" email. The Mosaico version seems to strip the gifs away. If I view the resulting email through our standard email reader, it moves. If I view it through outlook, it does not....


1

you can also do it this way by defining javascript array. var Values = new Array(); Values.push("value1"); Values.push("value2"); Values.push("value3"); $("#my_select2").val(Values).trigger('change');


1

Can you try below patch on shoreditch extension to see if it fixes your problem? diff --git a/js/main-menu.js b/js/main-menu.js index c4bd2576..c87ba81d 100644 --- a/js/main-menu.js +++ b/js/main-menu.js @@ -63,9 +63,12 @@ * @return {boolean} */ function isQuickSearchOnGoing () { - var searchValue = $('#sort_name_navigation').val() || ''; - - ...


1

I have a contribution form layout similar to Coleman's that shows clickable amounts (pseudo-buttons) instead of visible radio buttons. It also has the "Other Amount" pseudo-button (see below). In order to get the right behavior, I had to also trigger the click() event on the radio button for the "Other Amount". This then correctly updated all the visual ...


1

You are in the right path, if you look at the CRM_Core_Session class you'll see the method getStatus which takes a boolean as a parameter, if TRUEthen it will reset the status. That said, I would create a extension or use an existing one and implement hook_civicrm_postProcess. You'll need to know what is the class/form name of the form you are targeting, ...


1

Hmm--in theory Drupal jQuery Update shouldn't make a difference. Ye olde jQuery in Drupal is the reason CiviCRM has its own CRM.$ or cj instead of regular $ or jQuery. Something must be using the wrong one. If I had to guess, I'd say that some code isn't within a closure.


1

What happens if you change themes to one of the basics? This looks somewhat similar in end result to the Backbone errors that are occurring with some of the themes. Do you see errors on the Manage Events -> Online Registration page also?


1

Since you are using 4.6, the answer is that you need to ensure templates/CRM/common/wysiwyg.tpl is being loaded and that the smarty variable $includeWysiwygEditor is set to true. Or since you are hacking around CiviCRM anyway, just keep it simple and stick something like this in your page source: <script type="text/javascript" src="/path/to/civicrm/...


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