Add GUI elements to manage account names
parent
9bcb3adfe2
commit
73da74a870
|
@ -2,6 +2,7 @@ import * as Data from "../data.js";
|
|||
import * as Form from "../form.js";
|
||||
|
||||
const submissionForm = document.getElementById('submission-form');
|
||||
const nameTextbox = document.getElementById('name-textbox');
|
||||
const emailTextbox = document.getElementById('email-textbox');
|
||||
const passwordTextbox = document.getElementById('password-textbox');
|
||||
const adminCheckboxSection = document.getElementById('admin-checkbox-section');
|
||||
|
@ -16,6 +17,8 @@ async function Initialize() {
|
|||
const account = await Data.getAccount(accountID);
|
||||
console.log(account);
|
||||
|
||||
nameTextbox.value = account.name;
|
||||
|
||||
emailTextbox.value = account.email;
|
||||
|
||||
passwordTextbox.placeholder = "leave unchanged";
|
||||
|
@ -37,6 +40,8 @@ async function Initialize() {
|
|||
adminCheckboxSection.style.visibility = "visible";
|
||||
adminCheckbox.disabled = false;
|
||||
}
|
||||
nameTextbox.disabled = false;
|
||||
nameTextbox.addEventListener('keyup', checkDataValidity);
|
||||
emailTextbox.disabled = false;
|
||||
emailTextbox.addEventListener('keyup', checkDataValidity);
|
||||
passwordTextbox.disabled = false;
|
||||
|
@ -49,6 +54,7 @@ async function checkDataValidity() {
|
|||
let dataIsValid = true;
|
||||
|
||||
if(!passwordTextbox.value && !passwordTextbox.placeholder) dataIsValid = false;
|
||||
if(!nameTextbox.value) dataIsValid = false;
|
||||
if(!emailTextbox.value) dataIsValid = false;
|
||||
|
||||
if(dataIsValid) submitButton.disabled = false;
|
||||
|
|
Reference in New Issue