9

I am the author of a CiviCRM extension that needs to disable, depending on configuration, the URL tracking and open tracking checkboxes of the mailing form. In version 4.4 this was accomplished using hook_civicrm_buildForm (CRM_Mailing_Form_Settings) and calling the freeze method on those elements.

This form hook is not getting called in version 4.6, so how would I go about doing this now?

Thanks for looking.

3

I ended up adding a small bit of javascript that waits for Angular to build the form, then it disables the checkboxes. Don't know if it's the right way, but it works.

CRM.$(function($) {

function disable_tracking() {
    var i = $('#tab-tracking').length;

    if (i > 0) {
        $('input[name="url_tracking"]').attr('disabled', true);
        $('input[name="open_tracking"]').attr('disabled', true);
    }
    else setTimeout(disable_tracking, 250);
}

if ( (typeof(CRM.crmMailing) == 'object') && (CRM.vars.sendgrid.track_optional == '0') )
    disable_tracking();

})

  • Possible to share the JS code here? We are stuck with a similar problem and your code might help. Thanks – Ghost Oct 26 '15 at 10:56
  • Just added the code to my answer. Hope it helps. – konadave Oct 27 '15 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.