Form data is now parsed
This commit is contained in:
parent
f42355c4a1
commit
62c0767e78
1 changed files with 14 additions and 1 deletions
|
@ -26,7 +26,20 @@
|
||||||
|
|
||||||
function formHandler(listener){
|
function formHandler(listener){
|
||||||
listener.preventDefault();
|
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(){
|
function selectField(){
|
||||||
|
|
Loading…
Reference in a new issue