summaryrefslogtreecommitdiff
path: root/ishtar_common/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/static/js')
-rw-r--r--ishtar_common/static/js/ishtar.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js
index fcaa73053..6528d3797 100644
--- a/ishtar_common/static/js/ishtar.js
+++ b/ishtar_common/static/js/ishtar.js
@@ -1856,3 +1856,22 @@ var is_valid_issn = function(str) {
}
return (check == str[str.length-1].toUpperCase());
}
+
+var update_select_widget = function(input_name, values, only_values, excluded_values){
+ cvalue = $("#id_" + input_name).val();
+ var options = "";
+ for (var idx in values){
+ var option = values[idx];
+ if (!(option[0] && option[0] != cvalue
+ && ((excluded_values &&
+ excluded_values.indexOf(option[0]) != -1) ||
+ (only_values && only_values.indexOf(option[0]) == -1)
+ ))){
+ var selected = "";
+ if (option[0] == cvalue) selected = " selected";
+ options += "<option value='" + option[0] + "'" + selected + ">";
+ options += option[1] + "</option>";
+ }
+ }
+ $("#id_" + input_name).html(options);
+}; \ No newline at end of file