Skip to content

Commit

Permalink
fix timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
vwolfley committed Mar 23, 2024
1 parent 9c39ca8 commit 3e98c93
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions chamber/join.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h2 class="header">Join the West Valley Chamber of Commerce</h2>
<label class="top">Last Name* <input type="text" id="lname" name="lname" placeholder="Last Name" required /></label>
<label class="top"
>Title or Position*
<input type="text" id="position" name="position" required />
<input type="text" id="position" name="position" pattern="[a-zA-Z\- ]{7,}" required />
</label>
<label class="top"
>Email*
Expand Down Expand Up @@ -221,7 +221,7 @@ <h3>Links</h3>
</footer>
<!-- /Footer -->
<script src="scripts/chamberJS.js"></script>
<script src="scripts/timeStamp.js"></script>
<!-- <script src="scripts/timeStamp.js"></script> -->
<script src="scripts/form.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion chamber/scripts/chamberJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ async function getSpotLightMembers() {
}

function displaySpotlightMembers(members) {
console.log(members);
// console.log(members);

let topMembers = members.filter((member) => member.membership === "Silver" || member.membership === "Gold");

Expand Down
12 changes: 9 additions & 3 deletions chamber/scripts/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ function validateForm(event) {

elements.forEach((input) => {
if (input.value.trim() === "") {
showError();
isValid = false;
showError();
}
});
// Check if any radio option is selected
Expand All @@ -17,13 +17,14 @@ function validateForm(event) {
}
});
if (!radioSelected) {
showError();
isValid = false;
showError();
}

if (isValid) {
// Form is valid, submit it
setTimestamp()
timeStamp();
event.preventDefault(); // Prevent form submission
} else {
event.preventDefault(); // Prevent form submission
}
Expand Down Expand Up @@ -52,3 +53,8 @@ function showError() {
error.classList.add("hide");
}, 3000); // Hide the message after 3 seconds
}

// Function to set value of hidden input field with current date/time in milliseconds
function setTimestamp() {
document.getElementById("timestampmilli").value = Date.now();
}
14 changes: 4 additions & 10 deletions chamber/scripts/timeStamp.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
if (window.location.pathname === "/wdd230/chamber/thankyou.html") {
timeStamp();
}

function timeStamp() {
// Get the current date and time
var now = new Date();
const now = new Date();
// Define the options for the date and time
const options = {
weekday: "short",
year: "numeric",
Expand All @@ -18,13 +15,10 @@ function timeStamp() {
timeZoneName: "short",
};
// Format the date and time
var timestamp = now.toLocaleString("en-US", options);
const timestamp = now.toLocaleString("en-US", options);
// Display the timestamp
document.getElementById("timestamp").innerText = `Timestamp: ${timestamp}`;
}


// Function to set value of hidden input field with current date/time in milliseconds
function setTimestamp() {
document.getElementById("timestampmilli").value = Date.now();
}

2 changes: 1 addition & 1 deletion chamber/thankyou.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link type="text/css" rel="stylesheet" href="./styles/medium.css" />
<link type="text/css" rel="stylesheet" href="./styles/larger.css" />
</head>
<body id="record">
<body id="record" onload="timeStamp()">
<div class="container">
<h1>Application Confirmation</h1>
<p>Thank you for submitting the Application Request!</p>
Expand Down

0 comments on commit 3e98c93

Please sign in to comment.