-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
35 lines (29 loc) · 1.16 KB
/
scripts.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function validateForm() {
const name = document.getElementById('name').value;
const email = document.getElementById('email').value;
const message = document.getElementById('message').value;
// Check if all fields are filled out
if (name && email && message) {
// Allow form submission
return true;
} else {
alert('Please fill out all fields.');
return false; // Prevent form submission if validation fails
}
}
function showPopup() {
// Prevent default form submission to show the popup first
event.preventDefault();
// Show the popup
document.getElementById('popup').style.display = 'flex';
// Simulate sending the form (this would typically be handled by FormSubmit.co)
setTimeout(function() {
// Submit the form programmatically after the popup
document.getElementById('contact-form').submit();
}, 1500); // Slight delay before submitting the form
return false; // Prevent the form from submitting immediately
}
// Function to close the popup
function closePopup() {
document.getElementById('popup').style.display = 'none';
}