Table of Contents

Create a Registration Form with Limited Availability

Danielle Kellogg Updated by Danielle Kellogg

Scenario

You want to prevent users from submitting a form if certain criteria is reached.

For example, you’re hosting events with limited seating. Once the seating limit for the event is reached, you want to make sure no more users can register and alert them that the event is full.

In Knack, this kind of scenario can be accomplished using page rules.

Forms can also be prevented from submitting by using validation rules on fields, to limit what kind of data users can enter in forms.

At the end of this tutorial you will have a working page for users to register to limited-availability events. If the event has no more availability, the user will see an alert message and the registration form will be hidden.

Requirements

This article assumes you already have the following requirements fulfilled:

  1. A parent object (Events) that needs a limited amount of connected records
  2. A child object (Registrations) with a one-to-many connection to the parent (Events)
  3. A start page displaying records from the parent object (Events)

If this your first time creating an app, you'll need to know some basics about adding objects, fields, pages, and views. You can start by reading our Builder Basics section

Other good resources can be found in our designing the database and building pages sections of the knowledge base.

Steps

Add a Field to Track the Limit

You’ll need to store the number of children (Registrations) that each parent record (Event) is limited to.

In the Events object, add a new number field called "Registration limit":

Add a Field to Count Registrations

Before you can prevent the user from doing anything, you need to know how many registrations have already been submitted for a specific event.

In the Events object, add a count field called "Registration count" that counts the number of Registration records:

Don’t see a "Count" field as an option? Make sure that your Registrations object has a connection pointing to the Events object.

You can read more about using formula fields here.

Add a Field to Calculate Remaining Registrations

Now that you have a field storing the registration limit and t he registration count you can calculate the remaining registrations by subtracting the count field in step 2 from the limit field in step 1.

In the Events object, add a new equation field called "Registrations remaining" with the following formula:

{Registration limit} - {Registration count}

You can read more about using equation fields here.

Your Events object should now look like this:

Add a Child Page

Find the start page that users will access to view the Events. If you don’t have one yet, you can follow the steps here to create a new page.

If you already have an existing start page with views, you can click on the "Actions" tab while adding fields in your view editor to add a new link to view more details. You can read more on action links here.

Regardless of which step you take here, when creating your new child page be sure to add a form to create a new registration form connected to the Event on that page.

Not seeing the form option for "Registrations"? Make sure you have a connection between the the Event and the Registration.

Add the Page Rules

The final step is to add page rules that will trigger when the number of registrations reaches the limit.

From the child page, click on the "Rules" tab in the top menu and click on the “Add rule” button to add your first rule.

For the first rule, set your rule criteria so that it triggers when "Remaining registrations" is lower than 1.

The first rule will hide the registration view, so the action should remain as "Hide views". Click the box for the “Add Registration form”:

Add a second rule with the same criteria as the first rule and set the "action" to “Show a message.” Finally, configure your message by choosing between four different backgrounds, writing your own message, and choosing whether the user can or can not dismiss the message.

Save the rules by pressing the Save changes button.

You’re now successfully hiding the registration view as soon as the registration limit reaches 0!

Notes

  • This will not prevent a single user from submitting multiple registrations, the count is based on all connected children records.
  • You can add filters to your count and only track ‘paid’ registrations, exclude ‘cancelled’ registrations, etc.

How did we do?

Add a Pipeline to Your App

Add Stages to Your App

Contact