From 95136c4e857e606a411ba9c714a55c572596f710 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 20 Mar 2014 12:01:04 +0530 Subject: [PATCH] fix js to insert tokens for text message box --- templates/CRM/Mailing/Form/InsertTokens.tpl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/CRM/Mailing/Form/InsertTokens.tpl b/templates/CRM/Mailing/Form/InsertTokens.tpl index 9e502dd44d..dc31f61eb3 100644 --- a/templates/CRM/Mailing/Form/InsertTokens.tpl +++ b/templates/CRM/Mailing/Form/InsertTokens.tpl @@ -295,6 +295,7 @@ cj(function($) { if (field === 'html_message') { tokenReplHtml(token); } else { + field = textMsgID($(this)); $('#' + field).replaceSelection(token); } $(this).select2('val', ''); @@ -303,6 +304,20 @@ cj(function($) { } } + function textMsgID(obj) { + if (obj.parents().is("#sms")) { + field = 'sms #' + obj.data('field'); + } + else if(obj.parents().is("#email")) { + field = 'email #' + obj.data('field'); + } + else { + field = obj.data('field'); + } + + return field; + } + function tokenReplHtml(token) { var editor = {/literal}"{$editor}"{literal}; if ( editor == "tinymce" ) { -- 2.25.1