diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js
index ed87201e87..9de6d5f257 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js
@@ -188,7 +188,8 @@ define(function(require) {
function _submitWizard(context) {
var templateJSON = this.retrieve(context);
- var templateStr = $('textarea#template', $("form#createVMTemplateFormAdvanced")).val();
+ var contextAdv = context[0].id.replace("Wizard", "Advanced")
+ var templateStr = $('textarea#template', $("form#"+contextAdv)).val();
var template_final = TemplateUtils.mergeTemplates(templateJSON, templateStr);
if (this.action == "create") {
@@ -202,7 +203,8 @@ define(function(require) {
function _submitAdvanced(context) {
var templateStr = $('textarea#template', context).val();
- var templateJSON = this.retrieve($("form#createVMTemplateFormWizard"));
+ var contextWiz = context[0].id.replace("Advanced", "Wizard");
+ var templateJSON = this.retrieve($("form#"+contextWiz));
var template_final = TemplateUtils.mergeTemplates(templateStr, templateJSON, true);
template_final = TemplateUtils.templateToString(template_final);
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 7abfb01cda..fa66eb7db7 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
@@ -222,9 +222,16 @@ define(function(require) {
var userInputsJSON = UserInputs.retrieve(context);
- $.each(userInputsJSON, function(key,value){
+ $.each(userInputsJSON, function(key, value){
var name = key.toUpperCase();
- contextJSON[name.split("_")[2]] = "$" + name;
+ cntxt = name.split("_");
+ var keyName = "";
+ $.each(cntxt, function(key, value){
+ if(key >= 2){
+ keyName += value + "_";
+ }
+ });
+ contextJSON[keyName.slice(0,-1)] = "$" + name;
});
var start_script = WizardFields.retrieveInput($(".START_SCRIPT", context));
diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js
index 61021ed89a..f798323799 100644
--- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js
+++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js
@@ -276,8 +276,10 @@ define(function(require) {
var boot = _retrieveBootValue(context);
- if (boot.length > 0) {
+ if (boot && boot.length > 0) {
osJSON["BOOT"] = boot;
+ } else {
+ osJSON["BOOT"] = "";
}
if (!$.isEmptyObject(osJSON)) { templateJSON['OS'] = osJSON; };
diff --git a/src/sunstone/public/app/utils/template-utils.js b/src/sunstone/public/app/utils/template-utils.js
index af552fa8ee..bd3d7b9ad4 100644
--- a/src/sunstone/public/app/utils/template-utils.js
+++ b/src/sunstone/public/app/utils/template-utils.js
@@ -94,15 +94,19 @@ define(function(require) {
}
function _merge_templates(template_master, template_slave, advanced){
- if(!advanced)
+ if(!advanced){
template_slave = _convert_string_to_template(template_slave);
- else
+ } else {
template_master = _convert_string_to_template(template_master);
+ }
+ if(template_slave.USER_INPUTS){
+ delete template_slave.USER_INPUTS;
+ }
if((advanced && template_master) || (!advanced && template_slave)){
var template_final = {};
- $.extend(true, template_final, template_slave, template_master);
+ $.extend(template_final, template_slave, template_master);
return template_final;
- }else{
+ } else {
Notifier.notifyError(Locale.tr("Advanced template malformed"));
}
return template_master;
diff --git a/src/sunstone/public/app/utils/user-inputs.js b/src/sunstone/public/app/utils/user-inputs.js
index ade2231edd..8cd67afd62 100644
--- a/src/sunstone/public/app/utils/user-inputs.js
+++ b/src/sunstone/public/app/utils/user-inputs.js
@@ -650,8 +650,16 @@ define(function(require) {
input = '
';
break;
case "boolean":
- input = '
' + Locale.tr("YES ") + '';
- input += Locale.tr("NO ") + '';
+ if(value == "YES"){
+ input = '
' + Locale.tr("YES ") + '';
+ input += Locale.tr("NO ") + '';
+ } else if(value == "NO"){
+ input = '
' + Locale.tr("YES ") + '';
+ input += Locale.tr("NO ") + ''
+ } else {
+ input = '
' + Locale.tr("YES ") + '';
+ input += Locale.tr("NO ") + '';
+ }
break;
case "number":
case "number-float":