diff --git a/js/Common.js b/js/Common.js index 294f76b98b295d97f1c3abc569bcacf59e128062..8b926423078a1201c684940e0f7d9d4945be65bf 100644 --- a/js/Common.js +++ b/js/Common.js @@ -44,10 +44,12 @@ var cj = jQuery; function ts(text, params) { "use strict"; text = CRM.strings[text] || text; - if (params && typeof(params) === 'object') { + if (typeof(params) === 'object') { for (var i in params) { - // sprintf emulation: escape % characters in the replacements to avoid conflicts - text = text.replace(new RegExp('%' + i, 'g'), params[i].replace(/%/g, '%-crmescaped-')); + if (typeof(params[i]) === 'string') { + // sprintf emulation: escape % characters in the replacements to avoid conflicts + text = text.replace(new RegExp('%' + i, 'g'), params[i].replace(/%/g, '%-crmescaped-')); + } } return text.replace(/%-crmescaped-/g, '%'); } diff --git a/templates/CRM/Profile/Form/Dynamic.tpl b/templates/CRM/Profile/Form/Dynamic.tpl index 389f91f0c1e419666fc959de057596ad13eeb48d..971b8e2d065e28f19df9d3b163aaeffd2623c38f 100644 --- a/templates/CRM/Profile/Form/Dynamic.tpl +++ b/templates/CRM/Profile/Form/Dynamic.tpl @@ -341,7 +341,7 @@ cj(document).ready(function(){ var queryString = cj.param(formData); queryString = queryString + '&snippet=5&gid=' + {/literal}"{$profileID}"{literal}; var postUrl = {/literal}"{crmURL p='civicrm/profile/create' h=0 }"{literal}; - var blockNo = {/literal}{$blockNo}{literal}; + var blockNo = {/literal}{if $blockNo}{$blockNo}{else}null{/if}{literal}; var prefix = {/literal}"{$prefix}"{literal}; var response = cj.ajax({ type: "POST",