From 38577a117827092d747a9691650ae4240fb46b15 Mon Sep 17 00:00:00 2001 From: Ross Date: Sat, 23 Jan 2021 17:13:47 +0000 Subject: [PATCH] . --- rapids/templates/rapids/rapid_form.html | 26 +++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index 97d2fe3d..24964892 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -156,24 +156,20 @@ }); - // Hook into the form submission - function processForm(e) { - console.log("SUBMIT") - if (e.preventDefault) e.preventDefault(); - if (document.getElementById("id_normal").checked){ - $("#answer_form_set textarea").attr("required", false) - } - - return false; - } - - var form = document.getElementById('rapid-form'); - if (form.attachEvent) { - form.attachEvent("submit", processForm); + function ifNormal(){ + if (document.getElementById("id_normal").checked){ + $("#answer_form_set textarea").attr("required", false) } else { - form.addEventListener("submit", processForm); + $("#answer_form_set textarea").attr("required", true) } + } + + $("#id_normal").change(() => ifNormal()); + + ifNormal(); + + });