Skip to content
Snippets Groups Projects
Commit d51cf47d authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Check whether issue report field 2 is cleared before next properties are tried to be accesed

parent 183de825
No related branches found
No related tags found
1 merge request!98Resolve "Internal Server Error: /app/hjelp/issues/get_next_properties/ [Ticket#75418]"
Pipeline #48774 failed
...@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file. ...@@ -6,6 +6,14 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog`_, The format is based on `Keep a Changelog`_,
and this project adheres to `Semantic Versioning`_. and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* get_next_properties() is erroneously called when an issue report dropdown gets cleared
`2.0`_ - 2021-10-30 `2.0`_ - 2021-10-30
------------------- -------------------
......
...@@ -98,11 +98,10 @@ ...@@ -98,11 +98,10 @@
$(id).disabled = true; $(id).disabled = true;
} }
$.fn.setNextProperties = function (field_id, next_field_id, next_field_name) { $.fn.setNextProperties = function (field_id, next_field_id, next_field_name) {
var id = $('#' + field_id).find(':selected').val();
$.ajax({ $.ajax({
url: '{% url "issues_get_next_properties" %}', url: '{% url "issues_get_next_properties" %}',
data: { data: {
'id': id 'id': field_id
}, },
dataType: 'json', dataType: 'json',
success: function (data) { success: function (data) {
...@@ -123,13 +122,18 @@ ...@@ -123,13 +122,18 @@
}); });
} }
$("#{{ form.category_1.auto_id }}").on('input', function() { $("#{{ form.category_1.auto_id }}").on('input', function() {
$.fn.setNextProperties(this.id, "#{{ form.category_2.auto_id }}", "bug_category_2") $.fn.setNextProperties($('#' + this.id).find(':selected').val(), "#{{ form.category_2.auto_id }}", "bug_category_2")
if ($("#{{ form.category_3.auto_id }}").is(':visible')) { if ($("#{{ form.category_3.auto_id }}").is(':visible')) {
$.fn.hideAndDisable("#{{ form.category_3.auto_id }}") $.fn.hideAndDisable("#{{ form.category_3.auto_id }}")
} }
}); });
$("#{{ form.category_2.auto_id }}").on('input', function() { $("#{{ form.category_2.auto_id }}").on('input', function() {
$.fn.setNextProperties(this.id, "#{{ form.category_3.auto_id }}", "bug_category_3") let id = $('#' + this.id).find(':selected').val();
if (id !== "") {
$.fn.setNextProperties(id, "#{{ form.category_3.auto_id }}", "bug_category_3");
} else if ($("#{{ form.category_3.auto_id }}").is(':visible')) {
$.fn.hideAndDisable("#{{ form.category_3.auto_id }}")
}
}); });
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment