1 // http://civicrm.org/licensing
2 // JS needed for multilingual installations
4 // This is partially redundant with what the CRM.popup function would do,
5 // with a small amount of added functionality,
6 // and the difference that this loads unconditionally regardless of ajaxPopupsEnabled setting
7 $('body').on('click', 'a.crm-multilingual-edit-button', function(e
) {
9 $form
= $el
.closest('form'),
10 $field
= $('#' + $el
.data('field'), $form
);
12 CRM
.loadForm($el
.attr('href'), {
13 dialog
: {width
: '50%', height
: '50%'}
15 // Sync the primary language field with what the user has entered on the main form
16 .on('crmFormLoad', function() {
17 $('.default-lang', this).val($field
.val());
19 .on('crmFormSubmit', function() {
20 // Sync the primary language field with what the user has entered in the popup
21 $field
.val($('.default-lang', this).val());
22 $el
.trigger('crmPopupFormSuccess');