diff --git a/src/PassReset/formHandler.js b/src/PassReset/formHandler.js index 15ce9c9..ed8de35 100644 --- a/src/PassReset/formHandler.js +++ b/src/PassReset/formHandler.js @@ -1,13 +1,21 @@ -function handleSubmit(form) { +function handleSubmitManual(form) { const field = "password" const user = form.uid.value; const pass = form.oldPW.value; const newPW = form.newPW.value; const newPWConfirm = form.newPWConfirm.value; if (newPW === newPWConfirm){ - let obj = { "user": user , "pass": pass , "field": field, "value": newPW } + let obj = { "user": user , "pass": pass , "field": field, "value": newPW }; alert("Form submitted"); } else { alert("New passwords doesn't match"); } -} \ No newline at end of file +} + +const formEl = document.getElementById("reset"); +formEl.addEventListener('submit', () => { + event.preventDefault(); + const formData = new FormData(formEl); + const object = Object.fromEntries(formData.entries()); + console.log({ object }); +}); \ No newline at end of file