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 | 8355b16b1ae2f213de8d9f98221227f587e3b29f (patch) | |
| tree | 300713d38252ed0fb9d25e48e8499b29523b7985 /ishtar_common/static/js | |
| parent | eb7e96c07ad61a6e66fa8fd94f80fa317a99afb0 (diff) | |
| download | Ishtar-8355b16b1ae2f213de8d9f98221227f587e3b29f.tar.bz2 Ishtar-8355b16b1ae2f213de8d9f98221227f587e3b29f.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  | 
