feat(contact-form): implement consent checkbox and enable/disable submit button based on consent
All checks were successful
CI / test (3.11) (push) Successful in 11s
CI / build-image (push) Successful in 1m7s

This commit is contained in:
2025-11-06 11:26:29 +01:00
parent 91e5f41871
commit 2629f6b25f
3 changed files with 73 additions and 52 deletions

View File

@@ -23,17 +23,32 @@
<textarea id="message" name="message" required></textarea>
</div>
<div class="form-group">
<label for="consent"
>I agree to the processing of my submitted data.</label
<input
type="checkbox"
id="consent"
name="consent"
required
style="display: inline-block; width: auto"
/>
<label for="consent" style="display: inline-block">
<span style="color: red">*</span> I agree to the processing of my
submitted data.</label
>
<input type="checkbox" id="consent" name="consent" required />
</div>
<button type="submit">Send Message</button>
<button id="contactSubmit" class="btn" type="submit" disabled="true">
Send Message
</button>
</form>
<div id="responseMessage"></div>
</div>
<script>
document
.getElementById("consent")
.addEventListener("change", function (e) {
const submitButton = document.getElementById("contactSubmit");
submitButton.disabled = !e.target.checked;
});
document
.getElementById("contactForm")
.addEventListener("submit", function (e) {