Overview

Want to automatically stop parents from submitting a form after your registration period ends?
You can easily do this by adding a small JavaScript snippet in your Enrollio Form or Website Page Settings.

This script hides your form and replaces it with a friendly message — for example, “Registration is now closed” — once your specified date has passed.

How It Works

When someone visits your registration page:

  • If it’s before your cutoff date, the form appears as usual.

  • If it’s after your cutoff date, the form is automatically replaced with your custom message (e.g., “Registration is now closed”).

You can copy and paste this code into your page’s Custom JS section (in your Enrollio Funnel or Website settings):

<script>
  document.addEventListener("DOMContentLoaded", function() {
    // Set the cutoff date (YYYY-MM-DD)
    const cutoffDate = new Date('2025-10-15'); // 👈 change this
    const today = new Date();

    // Select the form element — update selector if needed
    const formElement = document.querySelector('form'); 

    // If the cutoff date has passed, replace the form with a message
    if (today > cutoffDate && formElement) {
      const message = document.createElement('div');
      message.innerHTML = `
        <div style="text-align:center; padding:40px; border-radius:10px; background:#fff8e1; border:1px solid #ffe082;">
          <h2 style="color:#333; margin-bottom:10px;">Registration is Now Closed</h2>
          <p style="font-size:1.1em; color:#666;">Thank you for your interest! Please check back for future events or contact us directly for more information.</p>
        </div>
      `;
      formElement.parentNode.replaceChild(message, formElement);
    }
  });
</script>


Optional Customizations

Target a specific form

If you have multiple forms on one page, replace this line:

document.querySelector('form')

with the form’s unique ID (you can find this by inspecting your form element):

document.querySelector('#form_abc123')

Adjust the cutoff timing

If you want the message to appear on the cutoff date instead of after it, change this line:

if (today > cutoffDate)

to

if (today >= cutoffDate)

Match your studio’s brand colors

You can adjust the background and border colors in the message box to match your studio’s branding:

background:#fffce8; border:1px solid #ffc300; color:#000814;

Where to Add the Script

Depending on how your form is added:

  • For Enrollio Funnel or Website Pages:
    Go to your Page Settings → Custom JS section and paste the script there.

  • For embedded forms on an external site:
    Add the script directly to the webpage where the form is embedded (not inside the form itself).

Support

If you need help adding or customizing this script, contact us at  support@enrollio.ai