From 7e74a08989ed7e842beb84cabb96eb7eace02799 Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 26 Oct 2017 11:13:58 +0200 Subject: [PATCH] B #5484: Custom vars in CONTEXT shouldn't let objects be created (#541) --- .../templates-tab/form-panels/create/wizard-tabs/context.js | 2 +- src/sunstone/public/app/utils/custom-tags-table.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js index 3062f979a0..32e6a57348 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js @@ -151,7 +151,7 @@ define(function(require) { }); UserInputs.setup(context); - CustomTagsTable.setup(context); + CustomTagsTable.setup(context, true); var selectOptions = { 'selectOptions': { diff --git a/src/sunstone/public/app/utils/custom-tags-table.js b/src/sunstone/public/app/utils/custom-tags-table.js index 1118d633d4..a3079642a3 100644 --- a/src/sunstone/public/app/utils/custom-tags-table.js +++ b/src/sunstone/public/app/utils/custom-tags-table.js @@ -37,7 +37,7 @@ define(function(require) { $(".change_to_vector_attribute", context).hide(); $(".custom_tag_value",context).focusout(function(){ var key = $(".custom_tag_key",this.parentElement.parentElement).val(); - if(!element.CAPACITY){ + if(element && !element.CAPACITY){ element.CAPACITY = {}; } element.CAPACITY[key] = this.value; @@ -72,7 +72,7 @@ define(function(require) { tr.remove(); if(hide_vector_button){ var key = $(".custom_tag_key",this.parentElement.parentElement.parentElement).val() - if(element.CAPACITY && element.CAPACITY[key]){ + if(element && element.CAPACITY && element.CAPACITY[key]){ delete element.CAPACITY[key]; Sunstone.runAction(resourceType+".update_template",elementID, TemplateUtils.templateToString(element)); }