Permalink
Browse files

Fix FormManager : dynamic selectors do not select default value corre…

…ctly when list returns groups.
  • Loading branch information...
1 parent 454dc0b commit 68d521e5394873be8dbd29ed9a1e99291d8e888e @cdujeu cdujeu committed Jul 20, 2016
Showing with 8 additions and 2 deletions.
  1. +8 −2 core/src/plugins/gui.ajax/res/js/ui/prototype/class.FormManager.js
@@ -428,15 +428,21 @@ Class.create("FormManager", {
var opt = new Element("OPTGROUP", {label:key});
element.insert(opt);
for (var index=0;index<json.LIST[key].length;index++){
- element.insert(new Element("OPTION").update(json.LIST[key][index].action));
+ var option = new Element("OPTION").update(json.LIST[key][index].action);
+ if(json.LIST[key][index].action == defaultValue) {
+ option.setAttribute("selected", "true");
+ }
+ element.insert(option);
}
}
}
}else{
for (key in json.LIST){
if(json.LIST.hasOwnProperty(key)){
var option = new Element("OPTION", {value:key}).update(json.LIST[key]);
- if(key == defaultValue) option.setAttribute("selected", "true");
+ if(key == defaultValue) {
+ option.setAttribute("selected", "true");
+ }
element.insert(option);
}
}

0 comments on commit 68d521e

Please sign in to comment.