Contact form: set min date to today on event date picker
This commit is contained in:
parent
252865f626
commit
33116e6c02
@ -10,8 +10,15 @@
|
|||||||
const submitBtn = document.getElementById('submitBtn');
|
const submitBtn = document.getElementById('submitBtn');
|
||||||
const textarea = form.querySelector('textarea[name="message"]');
|
const textarea = form.querySelector('textarea[name="message"]');
|
||||||
const phoneInput = form.querySelector('input[name="phone"]');
|
const phoneInput = form.querySelector('input[name="phone"]');
|
||||||
|
const dateInput = form.querySelector('input[name="eventDate"]');
|
||||||
let selectedFiles = [];
|
let selectedFiles = [];
|
||||||
|
|
||||||
|
// Forbid past dates (today is allowed)
|
||||||
|
if (dateInput) {
|
||||||
|
const t = new Date();
|
||||||
|
dateInput.min = `${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Textarea auto-resize
|
// Textarea auto-resize
|
||||||
textarea.style.overflow = 'hidden';
|
textarea.style.overflow = 'hidden';
|
||||||
textarea.addEventListener('input', function () {
|
textarea.addEventListener('input', function () {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user