Time & Date Input Field in WP Fluent Forms WordPress Plugin
Adding a Time & Date input field in your forms is easy with WP Fluent Forms. Here is how you can do that.
To add this field to your form, drag and drop the field from the available input fields.
To enable customization, click on the edit icon you get when hovering over the field. Or click on the Input Customization tab in right sidebar when the field is selected.
In the Input Customization section, you can customize the Time & Date input field in the following ways. In this section, you will find 2 portions:
- Default Fields. 2. Advanced Options
The basic configuration available for the Time & Date input field are as followed:
- Element Label: This is the text that users will see on the form for the Time & Date input field. You can put any text here that helps to understand the purpose of that field.
- Label Placement: Determine the placement of the label, that you set previously, in respect to the input field. The available options are ‘Top’, ‘Left’, ‘Right’, ‘Default’. All of those are self-explanatory except the ‘Default’. What it means is, it will represent your global label placement settings.
- Admin Field Label: If you want to show a different label for your admin users when they view the form submissions you can configure that using this option. It doesn’t have any actual effect on the form rather only for administrative purposes.
- Placeholder: You can also have a placeholder by which users will perceive the field subject.
- Date Format: Select any date format from the drop-down. The user will be able to choose a date in this given format.
- Required: Determine whether the field could be empty or not when the user submits your form by choosing the appropriate option from here.
The advanced options available for the Time & Date input field are as followed:
- Default value: You can pre-populate the field’s value, means setting a default value, using one of the available options here. Let’s see what are the things we can do here.
– Populate by GET Param: sets the default value from the query string found in the URL. Make sure you keep the ‘get.’ part otherwise it won’t work as you expected.
– IP Address: sets the value from the user’s IP address.
– Date (mm/dd/yyyy): sets the value from the current date in the denoted format, e.g. 04/25/1991.
– Date (dd/mm/yyyy): sets the value from the current date in the denoted format, e.g. 25/04/1991.
– Embedded Post/Page ID: sets the value from the current post or page ID.
– Embedded Post/Page Title: sets the value from the current post or page title.
– Embedded URL: sets the value from the current URL.
– User ID: sets the value from the logged in user’s ID.
– User Display Name: sets the value from the logged in user’s display name.
– User First Name: sets the value from the logged in user’s first name.
– User Last Name: sets the value from the logged in user’s last name.
– User Email: sets the value from the logged in user’s email.
– User Username: sets the value from the logged in user’s username.
– User Browser Client: sets the value from the logged in user’s browser name.
– User Operating System: sets the value from the logged in user’s OS name.
- Container Class: Use this option to add your custom CSS classes to the field’s wrapper.
- Element Class: Similarly, you can add custom CSS classes to the input field itself.
- Help Message: To guide your user thoroughly you can use this option. Just add your text here and it will be shown as a help message to the user.
- Name Attribute: The input field’s name attribute is the HTML equivalent of the same name. You don’t need to modify this.
- Conditional Logic: You can create certain rules to dynamically hide/show the input field based on the values from some other fields. To get a better understanding of Conditional Logic, read this.
Fluent Forms Date and Time field use flatpickr JS library and for advanced use you can provide the config object in the field’s advanced settings.
|altFormat||String||“F j, Y”||Exactly the same as date format, but for the altInput field|
|altInput||Boolean||false||Show the user a readable date (as per altFormat), but return something totally different to the server.|
|altInputClass||String||“”||This class will be added to the input element created by the altInput option. Note that
|allowInput||Boolean||false||Allows the user to enter a date directly input the input field. By default, direct entry is disabled.|
|ariaDateFormat||String||“F j, Y”||Defines how the date will be formatted in the
|clickOpens||Boolean||true||Whether clicking on the input should open the picker. You could disable this if you wish to open the calendar manually with
|dateFormat||String||“Y-m-d”||A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below.|
Sets the initial selected date(s).
If you’re using
Otherwise, you can supply a single Date object or a date string.
Initial value of the hour element.
Initial value of the minute element.
|disable||Array||||See Disabling dates|
By default, flatpickr utilizes native datetime widgets unless certain options (e.g. disable) are used.
|enable||Array||||See Enabling dates|
|enableTime||Boolean||false||Enables time picker|
|enableSeconds||Boolean||false||Enables seconds in the time picker.|
|formatDate||Function||null||Allows using a custom date formatting function instead of the built-in handling for date formats using
|hourIncrement||Integer||1||Adjusts the step for the hour input (incl. scrolling)|
|inline||Boolean||false||Displays the calendar inline|
|maxDate||String/Date||null||The maximum date that a user can pick to (inclusive).|
|minDate||String/Date||null||The minimum date that a user can start picking from (inclusive).|
|minuteIncrement||Integer||5||Adjusts the step for the minute input (incl. scrolling)|
||HTML for the arrow icon, used to switch months.|
|noCalendar||Boolean||false||Hides the day selection in calendar.
Use it along with
|onChange||Function, [functions]||null||Function(s) to trigger on every date selection. See Events API|
|onClose||Function, [functions]||null||Function(s) to trigger on every time the calendar is closed. See Events API|
|onOpen||Function, [functions]||null||Function(s) to trigger on every time the calendar is opened. See Events API|
|onReady||Function, [functions]||null||Function to trigger when the calendar is ready. See Events API|
|parseDate||Function||false||Function that expects a date string and must return a Date object|
Where the calendar is rendered relative to the input.
||HTML for the left arrow icon.|
|shorthandCurrentMonth||Boolean||false||Show the month using the shorthand version (ie, Sep instead of September).|
|showMonths||Integer||1||The number of months showed.|
|static||Boolean||false||Position the calendar inside the wrapper and next to the input element*.|
|time_24hr||boolean||false||Displays time picker in 24 hour mode without AM/PM selection when enabled.|
|weekNumbers||Boolean||false||Enables display of week numbers in calendar.|
|wrap||Boolean||false||Custom elements and input groups|
Please check flatpickr documentation for more details