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.

1

1 Answer 1

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();

})

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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