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:
- Build and finish your form first. If you already have one ready, just open it on your Form Builder.
- Add a Time Field to your form.
- Set its DEFAULT TIME to CURRENT.
- 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.
- 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.
- 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
If you want to incorporate a DATE into the equation, the idea is still relatively the same. Just go with the setup above, as is, only this time:
– With the addition of a DATE PICKER field to your form
– Include it as 1 of your IF Statements to trigger the SHOW / HIDE Action
Comments, suggestions and questions are always welcome! Feel free to post them below.