Skip to content

Commit

Permalink
Only reset attributes to default on radio button click when not
Browse files Browse the repository at this point in the history
already showing.
  • Loading branch information
duncanka committed Feb 4, 2018
1 parent 58345d1 commit f612637
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions client/src/annotator_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -881,9 +881,11 @@ var AnnotatorUI = (function($, window, undefined) {
$.each(attrTypes, function(attrNo, attr) {
var $input = $('#'+category+'_attr_'+Util.escapeQuotes(attr.type));
var attrIsApplicable = $.inArray(attr.type, validAttrs) != -1;

if (attrIsApplicable) {
$input.val(attr.default).change(); // reset form value to default
// If attribute is not currently showing, then reset form value to default.
if ($input.closest('.attribute_type_label').css('display') == 'none') {
$input.val(attr.default).change();
}
} else {
$input.val('').change(); // clear form value to avoid submitting inapplicable default value
}
Expand Down

0 comments on commit f612637

Please sign in to comment.