I’m attempting to trigger a Campaign:after_save logic hook which automatically creates the company’s default tracker URLs and assigns them to the $bean->id of the campaign. This is the current concern, I will also be looking to automatically generate/save the company’s default CapturePersonForm HTML with the $bean->id of the campaign pre-placed and ready to go live.
I’m requesting a bit of assistance in passing some variables to the CampaignTrackers Save from the Campaign’s Logic Hook. I’m assuming this is best to happen by somehow $_POSTing data directly to the CampaignTrackers form handler PHP. I’m missing a step to achieve this but can’t figure out how to get to my end result.
Web Interface -> Create Campaign -> enter Campaign Name and next -> auto generate 4 default campaign trackers to automate the process and assign to campaign.
I just thought that I’d add that I believe I’m pretty close to achieving this. Here’s the furthest find that I’ve reached. A section from the file: “cache/smarty/templates_c/%%1D^1DF^1DF975AD%%WizardMarketing.html.php”. I was thinking I would somehow send the pre-determined variables in the same way this is.
var onCampaignTrackerSaveClick = function() {
var trackerName = $(\'#tracker_name\').val();
var trackerURL = $(\'#tracker_url_add\').val();
// validate elements fisrt
var errors = [];
if(!trackerName) {
errors.push({field: \'tracker_name\', message: \''; ?>
<?php echo $this->_tpl_vars['MOD']['ERR_REQUIRED_TRACKER_NAME']; ?>
<?php echo '\'});
}
if(!trackerURL) {
errors.push({field: \'tracker_url\', message: \''; ?>
<?php echo $this->_tpl_vars['MOD']['ERR_REQUIRED_TRACKER_URL']; ?>
<?php echo '\'});
}
hideFieldErrorMessages();
if(errors.length) {
for(var i=0; i
<?php echo $this->_tpl_vars['CAMPAIGN_ID']; ?>
<?php echo '\',
tracker_name: trackerName,
tracker_url: trackerURL,
is_optout: $(\'#is_optout\').prop(\'checked\') ? \'on\' : \'\',
response_json: true
}, function (resp) {
resp = JSON.parse(resp);
if (resp.data.id) {
// TODO do it only when user want to create a new one as "copy and save.." function
$(\'select[name="tracker_url"]\').append(\'\' + trackerName + \' : \' + trackerURL + \'\');
$(\'select[name="tracker_url"]\').val(\'{\' + trackerName + \'}\');
$(\'#url_text\').val(\'{\' + trackerName + \'}\');
}
setTrackerUrlSelectVisibility();
//insert_variable_html_link(document.wizform.tracker_url.value);
});
}
};