Merge branch '9783-cwl-error-invalid-dir' closes #9783
[arvados.git] / apps / workbench / app / views / application / report_issue_popup.js.erb
index a1306653bffe36b107bac15c14ed6fcd4a8e5afc..73830ee0494b6e6039cdf3fb2a3c2c52c717f415 100644 (file)
@@ -1,21 +1,12 @@
 $("#report-issue-modal-window").html("<%= escape_javascript(render partial: 'report_issue_popup') %>");
 $("#report-issue-modal-window .modal").modal('show');
 
-// Disable the submit button until the problem description is entered
+// Disable the submit button on modal loading
 $submit = $('#report-issue-submit');
-
-var problem_desc = document.forms["report-issue-form"]["report_issue_text"].value;
-if (problem_desc == null || problem_desc == "") {
-  $submit.attr('disabled', true);
-}
+$submit.prop('disabled', true);
 
 // capture events to enable submit button when applicable
 $('#report_issue_text').bind('input propertychange', function() {
   var problem_desc = document.forms["report-issue-form"]["report_issue_text"].value;
-
-  var trigger = false;
-  if (problem_desc == null || problem_desc == "") {
-    trigger = true;
-  }
-  trigger ? $submit.attr('disabled', true) : $submit.removeAttr('disabled');
+  $submit.prop('disabled', (problem_desc === null) || (problem_desc === ""));
 });