From 1ab6b2188f17173e6d0fab14f0d67d624dc4c2e3 Mon Sep 17 00:00:00 2001 From: Mitchell Moore <mmoo97@uab.edu> Date: Wed, 8 Jul 2020 11:52:08 -0500 Subject: [PATCH] make form submit only if valid --- app/static/scripts/function.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/static/scripts/function.js b/app/static/scripts/function.js index 9a909ff..889209d 100644 --- a/app/static/scripts/function.js +++ b/app/static/scripts/function.js @@ -3,12 +3,14 @@ function displayloading() { } function request_account() { - socket.emit('request account', { - username: document.getElementById("username").innerText, - fullname: document.getElementById("fullname").innerText, - reason: document.getElementById("reason").innerText, - email: document.getElementById("email").value - }) + if (document.getElementById("signup").valid){ + socket.emit('request account', { + username: document.getElementById("username").value, + fullname: document.getElementById("fullname").value, + email: document.getElementById("email").value, + reason: document.getElementById("reason").value + }); + } } function refresh() { -- GitLab