From 0773488463f0eb79db29fe27bf9546d4e2d62958 Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Thu, 9 Apr 2015 00:10:13 +0300 Subject: [PATCH] MT#11147 Consider bootstrap_method form field when vendor is unknown Change-Id: I9d36508cf79b9afce7fc189efbaa10b83f6f03ac --- share/templates/device/list.tt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/share/templates/device/list.tt b/share/templates/device/list.tt index ec9bdf0763..cc8e78baa0 100644 --- a/share/templates/device/list.tt +++ b/share/templates/device/list.tt @@ -41,8 +41,8 @@ function vendor2bootstrapMethod(vendorField){ }else{ bootstrapMethodField = vendorField.form['bootstrap_method']; } + var bootstrapMethod=''; if(vendorField && vendorField.value){//onchange and on load after error - var bootstrapMethod=''; var vendor = vendorField.value.toLowerCase(); switch(vendor){ case "cisco": @@ -56,13 +56,20 @@ function vendor2bootstrapMethod(vendorField){ } if(bootstrapMethod){ var length = bootstrapMethodField.options.length; + var found = false; for(var i=0; i < length; i++){ if(bootstrapMethodField.options[i].value == bootstrapMethod){ bootstrapMethodField.options[i].selected = true; + found = true; + break; } } + if(!found){ + bootstrapMethod = ''; + } } - }else if(bootstrapMethodField){//as said above - for initial load, to use Perl defined select default to show linked fields + } + if((!bootstrapMethod) && bootstrapMethodField){ //as said above - for initial load, to use Perl defined select default to show linked fields bootstrapMethod = bootstrapMethodField.options[bootstrapMethodField.selectedIndex].value; } bootstrapDynamicFields(bootstrapMethod);