Conditionally Enable or Disable a Form Based on Time

Added: May 28, 2017

There are occasions when you wanted to restrict access to your form on certain hours. Some use cases are when you:

- Cater registrations and you only want to accept entries during business hours.

- Offer promotions that are only available on certain hours.

- Handle applications on specific time slots.

Regardless, it all boils down to limiting your users from submitting the form during certain hours within a day. To achieve that, we only need these features to work hand in hand:

Time Field: This field will be used to get the current time when the form was opened.

Conditions: Conditions will be used to check if the user opened the form within the timeframe you specify.

Text Field: An optional but great addition to have. This will be used to give a visual cue to your users that the form is unavailable.

Let's get started:

1. Build and finish your form first. If you already have one ready, just open it on your Form Builder.

2. Add a Time Field to your form.

3. Set its DEFAULT TIME to CURRENT.

4. Set the field as READ-ONLY so users can't modify the time value being used with the Condition. An optional step is to HIDE it too if you don't want it seen by your users.

5. Add a Text Field that will conditionally show if a user opens the form outside of business hours. You're free to design this upon your discretion since the field accepts HTML/CSS. In this guide, we'll go with a simple text that will tell them that the form is not available.

6. Now, it's time to setup the Condition. It's worth noting that this is an advanced feature and requires good understanding of how to setup conditions. If you haven't done this before, we recommend you go over the guide we're linking below before you proceed.

Related guide: Smart Forms Using Conditional Logic

You need to decide when your form will be available. For this guide, we went with the usual business hours schedule of 10am to 6pm.

So, this is how the Condition would look like:

In layman's terms, the logic goes like this:

IF Time IS BEFORE 10AM OR AFTER 6PM then DO

  SHOW the Text Field warning message AND

  HIDE MULTIPLE fields including the Submit Button

Setting up the condition like this should suffice in handling the visibility of the fields. For example, if there are certain fields that you want to remain visible even outside business hours, then just replace the SHOW action with SHOW MULTIPLE. Afterwards, include/exclude the fields you wish to be displayed.

Related guide: Hide or Show Multiple Fields at Once

Others may want to incorporate a date into the equation - The idea is relatively the same and straight forward. Just go with the setup above, as is, only this time:

1. With the addition of a Date Field to your form

2. And include it as 1 of your IF Statements to trigger the SHOW / HIDE Action.

You can view the completed form by clicking this link. We suggest you clone it if you want to have a closer look at how the form was built.

Comments, suggestions and questions are always welcome! Feel free to post them below.



Send Comment