Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Fix FormManager : dynamic selectors do not select default value corre…
Browse files Browse the repository at this point in the history
…ctly when list returns groups.
  • Loading branch information
cdujeu committed Jul 20, 2016
1 parent 454dc0b commit 68d521e
Showing 1 changed file with 8 additions and 2 deletions.
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 68d521e

Please sign in to comment.