From 62c0767e78f62583545ab0cf1b8b454798aa86c6 Mon Sep 17 00:00:00 2001 From: "eoghan.conlon" Date: Tue, 8 Aug 2023 18:48:22 +0100 Subject: [PATCH] Form data is now parsed --- src/recovery.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/recovery.html b/src/recovery.html index 826557c..ac4f399 100644 --- a/src/recovery.html +++ b/src/recovery.html @@ -26,7 +26,20 @@ function formHandler(listener){ listener.preventDefault(); - alert('Not implemented yet'); + const option = document.getElementById('options').value.toString(); + if(option === ''){ + alert("Need to implement this"); + } else { + const formData = new FormData(formEl); + const value = formData.get('value'); + let object; + if (option === 'email'){ + object = { email: value }; + } else { + object = { user: value }; + } + alert(JSON.stringify(object)); + } } function selectField(){