diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-11-27 11:26:55 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:21 +0100 |
commit | 975b971ae6efacbd5614be7f057f32d7c302966b (patch) | |
tree | 300713d38252ed0fb9d25e48e8499b29523b7985 /ishtar_common/static/js | |
parent | 30bf32d6768f3c013b44e1ed76d94f9954d6e565 (diff) | |
download | Ishtar-975b971ae6efacbd5614be7f057f32d7c302966b.tar.bz2 Ishtar-975b971ae6efacbd5614be7f057f32d7c302966b.zip |
Documents: dynamic filter of support and medium by document type - collapse related fields on edition
Diffstat (limited to 'ishtar_common/static/js')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 19 |
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 |