const bizform = document.querySelector('.js-bizform');

// If there is a Kentico Form instance on the page
if (bizform) {
    // Get all query string values
    const searchParams = new URL(document.location).searchParams;

    // Loop over query strings
    searchParams.forEach(function (value, key) {
        // Check if the query string key matches a field name
        const field = bizform.querySelector(`[data-name-field="${key}"]`);

        // If there is a match, store the value against the field
        if (field) {
            field.value = value;
        }
    });
}
