splendeo-dependent_select 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -31,11 +31,11 @@ function update_dependent_select( dependent_id, observed_id, values_array, // ma
|
|
31
31
|
|
32
32
|
// this fills the dependent select
|
33
33
|
values_array.each (function (e) {
|
34
|
-
if (e[2]==filter) {
|
35
|
-
var opt = new Element('option', {value: e[1]});
|
36
|
-
opt.text= e[0];
|
37
|
-
|
38
|
-
if(opt.value == previous_value) { opt.selected=true; }
|
34
|
+
if (e[2]==filter) { // only include options with the right filter field
|
35
|
+
var opt = new Element('option', {value: e[1]}); // create one <option> element...
|
36
|
+
if(collapse_spaces) { opt.text= e[0];} // assign the text (spaces are automatically collapsed)
|
37
|
+
else { opt.text = e[0].replace(/ /g, '\240'); } // replacing spaces with if requested
|
38
|
+
if(opt.value == previous_value) { opt.selected=true; } // mark it as selected if appropiate
|
39
39
|
dependent_field.options[dependent_field.options.length]=opt; // attach to depentent_select.. could not use "add"
|
40
40
|
}
|
41
41
|
});
|