Documentation Index

Fetch the complete documentation index at: https://knowledge.technolutions.net/llms.txt

Use this file to discover all available pages before exploring further.

Preventing Query String Parameter Bleed-Through in Group Registrations

Prev Next

When a form uses query string parameters to prefill registrant information, those values can also appear in the hidden template used by a group registration block. If the template keeps those values, each additional registration row can inherit the original registrant's information.

You can add custom JavaScript to clear the registration block template after the form loads. New rows added from the template will then start blank, while the first registration can still use the intended prefilled values.

📝 Note

This approach uses custom JavaScript. Test it thoroughly in a development environment, especially if the form includes default values, payment widgets, conditional logic, or required fields inside the registration block.

   
       

⭐ Get Inspired

   
   

This article was adapted from a post by Technolutions staff in the Slate Community Forums' Get Inspired space. Have a great idea for a Get Inspired post? Let us know!

When to use this pattern

Use this pattern when all of the following are true:

  • The form or event uses a registration block for group registration.

  • The form URL uses query string parameters to prefill values, such as a record GUID or specific form fields.

  • Additional registration rows should not inherit those prefilled values.

Add the basic cleanup script

  1. Open the form or event.

  2. Select Edit Form.

  3. Select Edit Scripts / Styles.

  4. Open the Custom Scripts tab.

  5. Add the following script.

$(function() {
  function clearTemplate() {
    var template = $('tbody.replicate_template');

    template.find('input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"])')
      .attr('value', '');
    template.find('input[type="checkbox"], input[type="radio"]')
      .removeAttr('checked');
    template.find('select option')
      .removeAttr('selected');
    template.find('textarea')
      .text('');
  }

  setTimeout(clearTemplate, 50);
});

The script waits briefly after the page loads, finds the hidden registration block template, and clears text inputs, checkboxes, radio buttons, select values, and text areas in that template. It does not clear payment amount widgets.

Keep selected default values

The basic script clears default values from the registration block template. If specific fields should keep their default values in each additional registration row, exclude those fields by export key.

In the following example, fields with export keys keepthis and keepthis2 are not cleared.

$(function() {
  function shouldClear(field) {
    return $(field).closest('[data-export="keepthis"]').length === 0 &&
      $(field).closest('[data-export="keepthis2"]').length === 0;
  }

  function clearTemplate() {
    var template = $('tbody.replicate_template');

    template.find('input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"])')
      .filter(function() { return shouldClear(this); })
      .attr('value', '');

    template.find('input[type="checkbox"], input[type="radio"]')
      .filter(function() { return shouldClear(this); })
      .removeAttr('checked');

    template.find('select')
      .filter(function() { return shouldClear(this); })
      .find('option')
      .removeAttr('selected');

    template.find('textarea')
      .filter(function() { return shouldClear(this); })
      .text('');
  }

  setTimeout(clearTemplate, 50);
});

To exclude more fields, add another condition to the shouldClear function and replace export-key with the field's export key:

&& $(field).closest('[data-export="export-key"]').length === 0

Test the form

  1. Open the form using the same query string parameters that will be used in production.

  2. Confirm that the intended first registrant values prefill correctly.

  3. Select the registration block's insert link to add another registrant.

  4. Confirm that the new registrant row starts blank, except for any fields intentionally excluded from the cleanup script.

  5. Submit a test registration and confirm that each registrant appears as its own registration row.

💡 Tip

Keep export keys short, stable, and descriptive. They are easier to target in custom scripts and easier to troubleshoot later.

📖 Group Registrations

📖 Prepopulating or Prefilling Forms Using Query String Parameters

📖 Form-Specific CSS (Custom Styles)

Still looking for what you need?