added stuff in pair programming session

This commit is contained in:
StockiP
2022-04-29 16:49:07 +02:00
parent c2789efcdc
commit cefac0c252
10 changed files with 179 additions and 16 deletions

28
js/registration.js Normal file
View File

@@ -0,0 +1,28 @@
const email = document.getElementById('email');
const password = document.getElementById('password');
const password2 = document.getElementById('password2');
password2.addEventListener('change', checkPassword);
function register() {
if (!checkPassword()) {
return;
}
const form = document.querySelector('#marmeladenLadenRegisterForm');
var formData = new FormData(form);
const jSONdata = JSON.stringify(Object.fromEntries(formData));
//print elements of jSONdata
console.log(jSONdata);
}
function checkPassword() {
if (password.value != password2.value) {
password2.setCustomValidity('Passwords do not match');
return false;
} else {
password2.setCustomValidity('');
return true;
}
}