Enable or Disable a Form Based on Time Using Conditions

August 18, 2022

There were occasions when you wanted to restrict access to your form at certain hours. Some use cases are the following:

  • Cater registrations, and you only want to accept entries during business hours.
  • Offer promotions that are only available during 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 — You will use this field to get the user’s current time when they open your form.
  • Text Field — You can use this to display a message telling your users that the form is unavailable.
  • Conditions — The conditions will check if the user opened the form within the specified timeframe.

You can watch the video below or proceed to the text instructions.

Adding and Setting up the Time Field

The whole setup requires the time field with its default time. Here’s how to add and set it up:

  1. In the Form Builder, click the Add Form Element button.
  2. Under the Basic elements, find and click the Time field to add. You can also drag and drop it to your form.
jotform-form-builder-add-time-field.png
  1. Click the gear icon in the Time field to open its Properties.
  2. In the Time Properties window, go to the Options tab.
  3. Set the Default Time to Current. You’ll automatically see your current time in it.
time-properties-default-time-options
  1. Under the Advanced tab, toggle the Read Only and Hide Field options to On to make the Time field uneditable and hidden from your form.
time-properties-read-only-and-hidden

You now have the Time field up and ready. Let’s go with adding the Text field.

Adding and Setting up the Text Field

Adding the Text field is partly optional. However, your users may wonder why your form is empty. In this case, we suggest adding it to display a message.

  1. Still, in the Form Builder, click the Add Form Element button.
  2. Look for and click the Paragraph field to add.
  3. Click the Edit Text (pencil icon) on the right side of the Paragraph element. You can also double-click the element to edit it.
  4. Add your custom message. You’re free to design this at your discretion. Here’s an example:
jotform-form-builder-paragraph-element-with-custom-message
  1. Click the Save (check icon), and that’s it!

Setting up the Conditional Logic to Display the Message and Hide the Fields

Now, it’s time to set up the condition. It’s worth noting that this is an advanced feature and requires a good understanding of how to set up conditions. If you haven’t done this before, we recommend visiting this guide: Smart Forms Using Conditional Logic.

First, you need to decide when your form will be available. We’ll use 10:00 AM to 6:00 PM as an example. Let’s proceed.

  1. In the Form Builder, go to the Settings tab.
  2. Click Conditions on the left panel.
  3. Choose Show / Hide Field option.
jotform-conditions-show-hide-field
  1. Set up your condition as shown in the image below:
jotform-show-hide-fields-based-on-time

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

If Time is Before 10:00 AM or After 6:00 PM, Show the Custom Message and Hide the other fields, including the submit button.

For more information on the Show and Hide Field condition, visit the following user guides:

Note:

The above is limited to showing or hiding fields based on the Time field. However, you can incorporate the Date field into the overall setup. Just add the Date Picker and adjust your condition appropriately.

You can view our demo form through this link: https://www.jotform.com/222295636075157. Feel free to clone the form to make a closer look and adjust the hours to mimic the result. To clone, visit: How to Clone an Existing Form From a URL.

Was this guide helpful?
Contact Support:

Our customer support team is available 24/7 and our average response time is between one to two hours.
Our team can be contacted via:

Support Forum: https://www.jotform.com/answers/

Contact Jotform Support: https://www.jotform.com/contact/

Send Comment:

Jotform Avatar
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Comments:

  • LaWanza Spears
  • Iain Robertson