You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prevents person from taking the same Survey twice
// Checks for cookie existance
var getCookie = function (name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
};
// Writes a cookie that expires tomorrow
function createCookie(name,value,path) {
var expires = "";
var date = new Date();
var tomorrow = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 23, 59, 59);
expires = "; expires=" + tomorrow.toGMTString();
if (!path) {
path = "/";
}
document.cookie = name + "=" + value + expires + "; path=" + path;
}
// Assign a variable for our cookie
var surveyTaken = getCookie("_surveyCookie")
// If cookie exists, remove the ability to take the quiz again
if(surveyTaken == undefined){
// They haven't taken the quiz, so move on!
console.log("Survey not taken");
// Write the cookie now.
createCookie("_surveyCookie","completed")
} else{
// They have taken the Survey already, show denied message
console.log("Survey already taken");
// Hide the form for folks who've already submitted the form
var surveyContent = document.getElementById("formContainer");
surveyContent.innerHTML = '<section class="page-layout__section"><strong>We have received your survey submission. Thank you for the feedback. For additional feedback, please <a href="/contact">Contact Us</a>.</section>';