Would you like to restrict what date and time options can be selected in your WordPress forms? For example, if your office is only open from 9am-5pm, Monday through Friday, then you’d probably want to prevent visitors from making an appointment outside of those days and times.
In this tutorial, we’ll show you how to limit options for the Date / Time field in WPForms.
Before getting started, you’ll first need to make sure that WPForms is installed and activated on your WordPress site.
After you’ve opened up your form, be sure to add a Date / Time field if you haven’t already. Then, click on the field within the builder’s preview panel to open its Field Options. This panel is where you can customize your field, including limiting the available date and time options.
Within the Field Options panel, go ahead and click on Advanced Options.
This will open up additional settings that you can customize, including options to limit available dates and times.
Limiting the Date
In order to limit which dates are available for your users to choose, first check the Limit Days checkbox.
This will open up a list of days that you can enable or disable within your forms. If you’d like to block a specific day of the week from being chosen, you can simply uncheck the box to disable it.
Disabling Past Dates
In addition to choosing which days of the week are available for your users to choose, you can also prevent users from being able to choose past dates within your forms. To do this, you’ll just need to check the box labeled Disable Past Dates.
When dates are disabled, they will show as greyed out on the front end of your site.
Limiting the Time
Similarly, you can limit which hours are available for your users to choose from within your forms. To open up the configuration options, check the box labeled Limit Hours.
This will expand to show additional options for the Start Time and End Time for your available hours. For each of these settings, you can click the dropdown and select a time to be shown to your users.
On the front end of your site, all available times between the selected Start Time and End Time will be available for your users to choose from.
That’s it! We just showed you how to limit the options for the Date / Time field in WPForms.
Next, would you like to allow your users to choose their payment method within your forms? Be sure to check out our tutorial on how to allow users to choose a payment method for more details.