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