added stuff in pair programming session
This commit is contained in:
28
js/registration.js
Normal file
28
js/registration.js
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user