URL Parameter Struggles

I am trying out this product in hopes of purchasing. The one and only (first) thing we need is the ability to pass in a unique code from our system to match the results to an event. I have a simple field with a single text field I named Text1 that I'd like to on form load prefill with a parameter passed through the URL. What am I missing?

Javascript Code I added:
fd.rendered(function() {
$.urlParam = function(name){
var results = new RegExp('[?&]' + name + '=([^&#]*)').exec(window.location.href);
return results[1] || 0;
}

// example.com?param1=name&param2=&id=6
fd.field('Text1).value = $.urlParam('id');
});

URL I used:
https://forms.plumsail.com/a7239043-7788-4000-a20d-833e317b7e57?id=555

Hello @IT.Joe,

Welcome to Plumsail Community!

You can use the code below to populate field with the URL parameter on form load.

fd.rendered(function() {
    const queryString = window.location.search;
    const urlParams = new URLSearchParams(queryString);
    // Replace SingleLineText0 with teh internal name of the field
    // 'id' is the name of the parametr
    fd.field('SingleLineText0').value = urlParams.get('id');
});
1 Like

Thank you. Worked like a charm