--- title: "Hide Payment Amount Widgets When Related Events Are Full" slug: "hide-payment-amount-widgets-when-related-events-are-full" updated: 2026-09-08T20:50:31Z published: 2026-09-08T20:50:31Z canonical: "knowledge.technolutions.net/hide-payment-amount-widgets-when-related-events-are-full" --- > ## 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. # Hide Payment Amount Widgets When Related Events Are Full A Payment Amount widget can stay active after a selected related event reaches capacity. The Related Event widget disables the full event, but selection-based conditional logic can continue to evaluate as true. Use custom JavaScript to set numeric indicator fields when Slate marks a related event as full or reports that no events are available. Conditional logic can then remove the Payment Amount from the total and show an unavailable message. > [!WARNING] > 📝 Note > > This configuration affects payment totals and uses custom JavaScript. Test every related-event, guest, and payment combination in a test environment before you use it on a live form. Retest the form after you change its fields, related-event setup, capacity settings, or script. > [!TIP] > ⭐ Get Inspired > > This article was adapted from [a post by Technolutions staff](https://community.technolutions.net/get-inspired/post/custom-javascript-for-full-related-events-conditional-logic-Yrmh6tXfUMvI3fC) in the Slate Community Forums' Get Inspired space. ## Before you begin Complete the related-event and payment setup first: - Add a Related Event widget and give it a unique **Export Key**. - Configure the related event's registrant limit and guest settings. - Add the Payment Amount and Payment Form widgets. - Use one mapped Related Event widget for each separately priced choice. If one Related Event widget lists several events and any listed event becomes full, this script marks the entire widget as unavailable. Separate the priced choices into individual widgets before you use this configuration. 📖 [Related Events](/v1/docs/related-events) 📖 [Payment Widgets in Forms](/v1/docs/form-payment-widget) ## Adding indicator fields 1. Add a Text Box field for each Related Event widget that controls a Payment Amount. 2. Configure the following settings: - **Label:** Enter an internal description, such as `Pre-Game Event Unavailable`. - **Data Type:** Select **Real**. - **Export Key:** Enter a unique key, such as `preGameUnavailable`. - **Options:** Select **Hidden / accessible through script**. 3. Place the indicator field in the same registration block as its Related Event widget. For a form without registration blocks, the indicator can appear anywhere on the form. 4. Optional: Add one more hidden Text Box field outside any registration block. Give it a **Data Type** of **Real** and an export key such as `allRelatedEventsUnavailable`. The script sets this field to `1` when all mapped related-event indicators are set to `1`. ## Adding the script 1. From the form, select **Edit Scripts / Styles**. 2. On the **Custom Scripts** tab, add the following script: ```javascript $(function() {    const eventMappings = {        "REPLACE WITH EXPORT KEY OF RELATED EVENT": "REPLACE WITH EXPORT KEY OF LOGIC FIELD",        "REPLACE WITH EXPORT KEY OF ANOTHER RELATED EVENT": "REPLACE WITH EXPORT KEY OF CORRESPONDING LOGIC FIELD"    };    const noEventsExport = "REPLACE WITH EXPORT KEY OF NO RELATED EVENTS";    const NO_EVENTS_TEXT = "There are no other available events to display for this date.";    function isFullOrNoEvents($related) {        const hasNoEvents = $related.find('span').filter((_, el) =>            $.trim(el.textContent) === NO_EVENTS_TEXT        ).length > 0;        const hasFull = $related.find('.form_response.full').length > 0;        return hasNoEvents || hasFull;    }    function getBlock($related) {        const $row = $related.closest('tr.column, tr');        if ($row.length) return $row;        const $form = $related.closest('.form_page, form').first();        return $form.length ? $form : $(document);    }    function updateAll() {        Object.entries(eventMappings).forEach(([related, indicator]) => {            $(`[data-export="${related}"]`).each(function() {                const $related = $(this);                const $block = getBlock($related);                const $input = $block.find(`[data-export="${indicator}"] input[type="text"]`).first();                if ($input.length) {                    const value = isFullOrNoEvents($related) ? "1" : "";                    if ($input.val() !== value) $input.val(value).triggerHandler("change");                }            });        });        const $noEvents = $(`[data-export="${noEventsExport}"] input[type="text"]`).first();        if (!$noEvents.length) return;        const allSet = Object.values(eventMappings).every(indicator => {            const inputs = $(`[data-export="${indicator}"] input[type="text"]`)                .filter((_, el) => !$(el).closest('tbody.replicate_template').length)                .toArray();            return inputs.length > 0 && inputs.every(input =>                $.trim($(input).val()) === "1"            );        });        const value = allSet ? "1" : "";        if ($noEvents.val() !== value) $noEvents.val(value).triggerHandler("change");    }    updateAll();    new MutationObserver(updateAll).observe(document.body, {        childList: true,        subtree: true,        attributes: true,        attributeFilter: ['class', 'style', 'aria-hidden']    });    $(document).on('change', '[data-export] input[type="checkbox"]', updateAll); }); ``` 3. In `eventMappings`, replace each placeholder with the export key of a Related Event widget and its corresponding indicator field. ![Configuration values at the beginning of the custom script](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/configure-related-event-fullness-script.png?sv=2026-02-06&spr=https&st=2026-11-17T01%3A34%3A19Z&se=2026-11-17T02%3A34%3A19Z&sr=b&sp=r&sig=1zycJJDxWqrRR5c52i%2FpZ8f1Ys5cotkSB3BmueLye34%3D) 4. Replace the `noEventsExport` placeholder with the global indicator export key. If you did not create this optional field, the script skips this value. 5. If the Related Event widget uses a **Custom Unavailable Message**, replace `NO_EVENTS_TEXT` with that exact message. 6. Select **Save**. ## Adding conditional logic ### Showing an unavailable message 1. Add an Instructions field with the message that should appear when an event is unavailable. 2. Add a conditional logic filter for the corresponding numeric indicator field. 3. Set the filter to show the Instructions field when the indicator is greater than `0`. ![Instructions field with a conditional logic filter that requires the numeric indicator to be greater than zero](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/show-full-related-events-message.png?sv=2026-02-06&spr=https&st=2026-11-17T01%3A34%3A19Z&se=2026-11-17T02%3A34%3A19Z&sr=b&sp=r&sig=kUdUMDc2RplVSvhlD%2Fosugyhdmktdr4Df5QNWDsS1C4%3D) 4. Select **Save**. Use the global indicator when one message should appear only after all mapped related-event choices are unavailable. ### Removing the Payment Amount 1. Edit the Payment Amount widget for the related event. 2. Configure the following conditional logic filters with an **AND** relationship: ![Payment Amount widget conditions that require the related event selection and no unavailable-event indicator value](https://cdn.us.document360.io/cd8ea7a6-07f3-4846-a554-627ac016d3e3/Images/Documentation/exclude-full-related-event-payment-amount.png?sv=2026-02-06&spr=https&st=2026-11-17T01%3A34%3A19Z&se=2026-11-17T02%3A34%3A19Z&sr=b&sp=r&sig=jJyaHbeLM5njb70QRBhKxZ4fRP2EfUtBG%2B%2Fs%2F%2F22TF0%3D) - The Related Event field contains the event that requires the charge. - **Form Field Exists** is set to **NOT EXISTS** for the corresponding indicator field. 3. Select **Save**. When the script sets the indicator to `1`, the second condition fails. Slate disables the Payment Amount field and recalculates the total without that amount. ## Testing the form Test each mapped event in a test environment: 1. Confirm that selecting an available related event adds the correct Payment Amount. 2. Make the related event full. Confirm that Slate shows the full message, the indicator is set to `1`, the Payment Amount is removed, and the total decreases. 3. Restore event availability. Confirm that the indicator clears and the original behavior returns. 4. Test the no-events message and the global indicator, if used. 5. For registration blocks, add and remove several registrants. Confirm that each indicator controls only the Payment Amount in the same block. 📖 [Form Conditional Logic](/v1/docs/form-conditional-logic)