Skip to content

Instantly share code, notes, and snippets.

View stevedrobinson's full-sized avatar

Steve Robinson stevedrobinson

  • Brilliant Metrics
  • Milwaukee, WI
View GitHub Profile
@stevedrobinson
stevedrobinson / mautic-form-preload.js
Last active June 15, 2023 20:45 — forked from shawncarr/mautic-form-preload.js
Pre-populate Mautic Form Data from Query String Parameters
(function(document){
function populateForms(){
if (document.readyState == 'interactive') {
if (document.forms.length !== 0 && location.search) {
var query = location.search.substr(1);
query.split('&').forEach(function (part) {
if (part.indexOf('=') !== -1) {
var item = part.split('=');
var key = item[0];
var value = decodeURIComponent(item[1]);