diff --git a/r2/r2/public/static/js/report.js b/r2/r2/public/static/js/report.js
index 9ff33aeda..ab0bcc1e1 100644
--- a/r2/r2/public/static/js/report.js
+++ b/r2/r2/public/static/js/report.js
@@ -5,6 +5,23 @@ $(function() {
return false
}
+ function toggleOther() {
+ var $reportForm = $(this).closest('.reportform');
+ var $submit = $reportForm.find('[type="submit"]');
+ var $reason = $reportForm.find('[name=reason]:checked');
+ var $other = $reportForm.find('[name="other_reason"]');
+ var isOther = $reason.val() === 'other';
+
+ $submit.removeAttr('disabled');
+
+ if (isOther) {
+ $other.removeAttr('disabled').focus();
+ } else {
+ $other.attr('disabled', 'disabled');
+ }
+ return false
+ }
+
function getReportAttrs($el) {
return {thing: $el.thing_id()}
}
@@ -39,4 +56,5 @@ $(function() {
$("div.content").on("click", ".tagline .reportbtn, .thing .reportbtn", openReportForm);
$("div.content").on("click", ".btn.report-cancel", toggleReportForm);
+ $("div.content").on("change", "input[name='reason']", toggleOther);
});
diff --git a/r2/r2/templates/reportform.html b/r2/r2/templates/reportform.html
index 449ab2cbb..fe5f83d8e 100644
--- a/r2/r2/templates/reportform.html
+++ b/r2/r2/templates/reportform.html
@@ -61,7 +61,7 @@
-