Winverständniserklärung nur bei unter 18

This commit is contained in:
Cay 2026-02-25 13:07:52 +00:00
parent a7b78cfed4
commit ab5d615194

View File

@ -84,6 +84,12 @@
<input name="nachname" class="form-control" placeholder="Nachname" required> <input name="nachname" class="form-control" placeholder="Nachname" required>
<input type="date"
name="geburtsdatum"
class="form-control"
placeholder="Geburtsdatum"
required>
<input name="mobil" class="form-control" placeholder="Mobilnummer" required> <input name="mobil" class="form-control" placeholder="Mobilnummer" required>
<input type="email" name="email" class="form-control" placeholder="E-Mail" required> <input type="email" name="email" class="form-control" placeholder="E-Mail" required>
@ -202,7 +208,7 @@
<input class="form-check-input" <input class="form-check-input"
type="checkbox" type="checkbox"
name="agreeConsent" name="agreeConsent"
required> id="agreeConsent">
<label class="form-check-label"> <label class="form-check-label">
Einverständnis gelesen Einverständnis gelesen
@ -276,6 +282,44 @@ function nextStep(step){
if(step === 3){ if(step === 3){
buildSummary(); buildSummary();
checkAgeAndConsent();
}
}
function checkAgeAndConsent(){
const data =
JSON.parse(localStorage.getItem('registerData'));
if(!data || !data.geburtsdatum) return;
const birth = new Date(data.geburtsdatum);
const today = new Date();
let age = today.getFullYear() - birth.getFullYear();
const m = today.getMonth() - birth.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birth.getDate())) {
age--;
}
const consentBox =
document.getElementById('agreeConsent');
if(!consentBox) return;
// Unter 18 → aktiv & Pflicht
if(age < 18){
consentBox.disabled = false;
consentBox.required = true;
} else {
// Ab 18 → deaktiviert
consentBox.checked = false;
consentBox.disabled = true;
consentBox.required = false;
} }
} }
@ -386,6 +430,7 @@ function buildSummary(){
let html = ` let html = `
<b>Name:</b> ${data.vorname} ${data.nachname}<br> <b>Name:</b> ${data.vorname} ${data.nachname}<br>
<b>Geburtsdatum:</b> ${data.geburtsdatum}<br>
<b>Email:</b> ${data.email}<br> <b>Email:</b> ${data.email}<br>
<b>Mobil:</b> ${data.mobil}<br> <b>Mobil:</b> ${data.mobil}<br>
<b>Adresse:</b> <b>Adresse:</b>