--- title: "Setting a Primary Registrant with Group Registrations" slug: "setting-a-primary-registrant-with-group-registrations" status: "new" updated: 2026-07-21T20:40:22Z published: 2026-07-21T20:40:22Z canonical: "knowledge.technolutions.net/setting-a-primary-registrant-with-group-registrations" stale: true --- > ## 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. # Setting a Primary Registrant with Group Registrations Use a hidden field and custom JavaScript to identify the first registrant in a group registration block as the primary registrant. After the form stores that value, you can use conditional logic to show different content, payment amounts, gift options, or instructions to the primary registrant and additional guests. > [!WARNING] > 📝 Note > > This article uses custom JavaScript. Test the behavior in a test environment before adding it to a production form. Update the script if your form page ID differs from the example. > [!TIP] > ⭐ Get Inspired > > This article was adapted from [a post by Technolutions staff](https://community.technolutions.net/get-inspired/post/custom-javascript-for-group-registration-blocks-setting-a-primary-C5mFKqcWjoDDf5r) in the Slate Community Forums' Get Inspired space. Have a great idea for a Get Inspired post? [Let us know](https://community.technolutions.net/get-inspired/new?post_type=gnHx7As1gZ8r6Ld)! ## Watch a video [YouTube video player](https://www.youtube.com/embed/mbVySlboVks?si=0qEp6ZHlxLrwXBJm) #### Try a Slate example 💼 Copy this [Suitcase](/docs/suitcase-import) ID and paste it in **Database → Suitcase Import** to import an example configuration: ```SuitcaseID 5085a369-94e1-436c-bba9-07876af2f190:slate-advancement-showcase ``` ## Configuring the primary field 1. Go to the form that contains the group registration block. 2. Add a field inside the registration block to store whether the registrant is primary. 3. Configure the field with a **Data Type** of **Real**. 4. Use `primary` as the field export key. 5. Hide the field if registrants should not see or edit it. ![Group registration block with a primary form field configured inside the block](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/01-ZsIimeJycLcdzMnR6q3Om.webp) ## Adding the script 1. In the form editor, select **Edit Scripts and Styles**. 2. Select the **Custom Scripts** tab. 3. Add the following script. ```JavaScript $(function() {    function setPrimary() {        // Clear the value of all primary inputs first.        $("[data-export='primary'] input").val("");        // Set the first registration block primary input to 1.        $("tbody.replicate_destination").first()            .find("[data-export='primary'] input")            .val("1")            .triggerHandler("change");    }    setTimeout(setPrimary, 50);    var observer = new MutationObserver(setPrimary);    var config = { childList: true, subtree: true };    observer.observe(document.getElementById('form_page_2'), config); }); ``` The example observes `form_page_2`. If the registration block is on another page, replace that value with the page ID from your form. ## Using the primary value in conditional logic The script sets the first registration block to `1` and clears the value for the other registration blocks. Use conditional logic to show objects to the primary registrant or to additional guests. ### Showing content for the primary registrant Use a **Numeric Value** condition to show the object when the `primary` field equals `1`. ![Numeric Value condition showing an object when the primary field equals 1](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/02-pM3mRPE8wXvNX38YBWmfv.webp) ### Showing content for additional guests Use a **Form Field Exists** condition to show the object when the `primary` field does not exist or is blank for the registrant. ![Form Field Exists condition showing an object when the primary field does not exist](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/03-bqi9JpHlAvIb9zIXmdVQf.webp) ## Testing the registration flow 1. Preview the form and add multiple registrants. 2. Confirm that the first registrant receives the primary-only content. 3. Confirm that additional registrants receive the guest-only content. 4. Remove and re-add registrants to confirm that the primary value resets correctly. For more information about registration blocks, see [Group Registrations](https://knowledge.technolutions.net/docs/group-registrations).