Powered by Formstack

document.addEventListener(“DOMContentLoaded”, function() {
// Function to get the value of the query parameter by name
function getQueryParamByName(name) {
name = name.replace(/[\[]/, “\\[“).replace(/[\]]/, “\\]”);
var regex = new RegExp(“[\\?&]” + name + “=([^&#]*)”),
results = regex.exec(location.search);
return results === null ? “” : decodeURIComponent(results[1].replace(/\+/g, ” “));
}

// Capture the value of the query parameter
var paramValue = getQueryParamByName(‘user’); // Replace ‘parameter’ with your actual parameter name

// Set the value to the hidden field in your Formstack form
var hiddenField = document.getElementsByName(‘Rep’)[0]; // Replace ‘hiddenFieldName’ with the name of your hidden field
if (hiddenField) {
hiddenField.value = paramValue;
}
});