From 0598349b1f08dc8ccbc50b9fdc186b911236c03f Mon Sep 17 00:00:00 2001 From: Krish <krish94@uab.edu> Date: Thu, 22 Apr 2021 11:02:29 -0500 Subject: [PATCH] added button to print error message --- app/static/scripts/function.js | 7 ++++++- app/templates/auth/SignUp.html | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/static/scripts/function.js b/app/static/scripts/function.js index 74d9b15..24ab04b 100644 --- a/app/static/scripts/function.js +++ b/app/static/scripts/function.js @@ -19,7 +19,12 @@ function request_account() { function renderDom(title, message, error_msg) { document.getElementById("form-wrapper").innerHTML = "<h2>" + title + "<br>"; document.getElementById("form-wrapper").innerHTML += "<h3>" + message + "<br>"; - document.getElementById("form-wrapper").innerHTML += "<p>" + error_msg; + if (error_msg !== null ) { + var error_button = document.createElement("BUTTON"); + error_button.innerHTML = 'Read Error Message'; + document.getElementById("form-wrapper").appendChild(error_button); + error_button.onclick = function(){document.getElementById("form-wrapper").innerHTML += "<br>" +error_msg} + } } function autofill_form(username, fullname, email) { diff --git a/app/templates/auth/SignUp.html b/app/templates/auth/SignUp.html index 74b88dd..f468233 100644 --- a/app/templates/auth/SignUp.html +++ b/app/templates/auth/SignUp.html @@ -98,7 +98,7 @@ </div> <br> <div class="col-md-7 col-sm-7 my-col"> - <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account cancel','close browser', '')">Cancel</button> + <button class="btn btn-danger btn-md" id="cancel" name="cancel" type="button" onClick="renderDom('Account cancel','close browser', null)">Cancel</button> <button class="btn btn-primary btn-md" id="submit" name="submit" type="button" value="Submit" onclick="displayloading1();request_account()"> Create Account</button> </div> </form> -- GitLab