Super Forms
  • Drag & Drop Form Builder for WordPress
  • Quick start
    • Installation
    • Registration
    • Starting your 15 day trial
    • Purchasing a license
    • Activating a license
    • First time setup
    • Secure file uploads
    • Creating a form
    • Adding form elements
    • Editing elements
    • Publishing your form
    • FAQ
  • Account
    • Dashboard
      • Your Invoices
      • Billing details
      • Your Licenses
      • E-mail Notification
      • Password reset
      • Cancel subscription
  • Common problems
    • Common problems
      • Email delivery problems
        • Why is my form not sending emails?
        • Why are emails going into spam folder/inbox?
      • File upload problems
      • Session expired
      • reCaptcha Troubleshooting – Fix “Not Loading” & Verification Errors
  • Elements
    • Layout elements
      • Column/Grid
      • Multi-part / step
    • Form elements
      • Calculator
      • Signature
      • File upload
      • Datepicker
      • Variable field
      • Dropdown
      • Text field
      • Autosuggest
      • Keywords
      • Radio button
      • Keyword Field
      • Button
      • Audio Recording (microphone)
    • HTML elements
      • Heading
      • HTML (raw)
      • Image
      • TinyMCE
      • Divider
      • Spacer
      • PDF page break
      • Google map element WordPress form
  • Features
    • Basic
      • Confirmations emails
      • Save Form Progression (continue later)
      • Build In Translation System
      • Populate form
      • Popups
      • Import & Export
      • Hide form after submitting
      • Hide or lock out user from your forms
      • Validation
    • Advanced
      • WordPress form with Google sheets dropdown
      • Custom registration form for WordPress
      • Custom login form for WordPress
      • Custom lost password form for WordPress
      • Update current logged in user
      • Secrets
      • Prevent duplicate entries
      • Lock & hide form
      • Password protect
      • Conditional Logic
      • Tags system
      • Address lookup/auto complete
      • Analytics Tracking
      • Conversion Tracking
      • Distance & Duration Calculation
      • If statements
      • Foreach loops
      • E-mail Reminders
      • Variable Fields
      • Form templates - Include elements into other forms - WordPress
      • Transferring data from one form to another
    • Integrations
      • PDF Generator
      • Listings
      • WooCommerce Checkout
        • Fixed price checkout
        • Dynamic price checkout
        • Variable product checkout (variations)
        • Replacing the "Add to cart" on a product page with a form
        • Hiding product from shop and order via custom form
      • PayPal
      • MailChimp
      • Mailster
      • Zapier
      • Stripe (BETA)
      • WooCommerce Instant Order (in progress)
  • Tutorials
    • WordPress Form to Google Sheet Integration
    • GDPR Consent / Terms agreement
    • How to update the plugin
    • Sending emails to specific department for WordPress contact forms
  • Example Forms for WordPress
    • Booking 24 hours ahead of time
  • Developers
    • Code Examples
      • Lookup City by Zipcode for your WordPress form
      • Audio Recording Field
      • Custom API Phone Number Validation for Your WordPress Form
      • Updating WordPress user meta data after login
      • Automatically redirecting to next step after displaying text or a progress bar
      • Dropdown with groups (categories)
      • Prevent form submission based on entered field values
      • Track form submissions with GTM (Google Tag Manager)
      • Tracking Multi-part steps with Google Analytics
      • Tracking Multi-part steps with GTM data layer (dataLayer.push)
      • Track form submissions with third party
      • Compare input field value with database value
      • Insert form data into a custom database table
      • Delete database row after contact entry is deleted in WordPress
      • Limited date availability (slots) for your WordPress booking form
      • Send submitted form data to another site
      • Exclude empty fields from emails
      • Execute custom JS when a column becomes conditionally visible
      • Toolset Plugin: Update comma separated string to Array for meta data saved via Front-end Posting
      • Toolset Plugin: Update file ID to file URL for meta data saved via Front-end Posting
      • Delete uploaded files after email has been send
      • Increase Cookie lifetime for client data such as [Form Progression]
      • Altering cookie secure and httponly parameters
      • Define fake cronjob to clear old client data if cronjob is disabled on your server
      • Define page language attribute based on page ID or URL
      • Define custom headers when doing a POST request
      • Change checkbox/radio layout to vertical on mobile devices
      • Show remaining available form submission allowed
      • Global fields / elements
      • Trim values of fields
      • Re-sending E-mails after editing entries via Listings for WordPress
      • Combine multiple field values into one column on Contact Entries page
      • Altering the attachments for E-mails via PHP code for WordPress
      • Generate dynamic columns with dates based on user selected date from Datepicker element
      • Hide `eye` icon from Listings row based on user role
    • Data storage
    • BETA version
  • Changelog
  • Support
Powered by GitBook
On this page
  • Explanation
  • Builder page:
  • Form elements code:
  1. Example Forms for WordPress

Booking 24 hours ahead of time

This WordPress form will only allow bookings that are at least booked 24 hours ahead of time. This can be useful for example reservations or renting services.

PreviousExample Forms for WordPressNextCode Examples

Last updated 11 months ago

You can copy paste the below under the [Code] tab on your form builder page

Explanation

This form contains two input fields for the user to fill out:

  • (named date in this example)

  • Timepicker (named time in this example)

The form will also contain four other fields to:

  • A Timepicker to set/grab the epoch of the current day @ 00:00 (start_time)

  • A Timepicker to set/grab the epoch of the current date and time (current_time)

  • A to add an additional 24 hours to the epoch based on the current date and time (future_timestamp)

  • A the calculate the difference between the user's chosen date and time and the start time (diff_timestamp)

Based on these values the epoch (timestamp) will be compared to the epoch that is 24 hours ahead of the current time. If the chosen date and time by the user is not 24 hours in the future the form will display a message (with the use of ) stating that they will have to pick a date and time that is at least 24 hours ahead in order to submit the form. When the selected date and time is 24 hours ahead of time a Submit button will be displayed to the user to submit the form.

Note: you will want to enable the option to "Prevent submitting form on pressing "Enter" keyboard button" under Form Settings > Form Settings on the builder page, so that the form can't be accidently submitted. This is a requirement because there is basically no validation applied on the form.

Builder page:

Form elements code:

[
    {
        "tag": "date",
        "group": "form_elements",
        "data": {
            "name": "date",
            "email": "Date:",
            "placeholder": "Select a date",
            "minlength": "1",
            "showMonthAfterYear": "",
            "showWeek": "",
            "showOtherMonths": "",
            "icon": "calendar"
        }
    },
    {
        "tag": "time",
        "group": "form_elements",
        "data": {
            "name": "time",
            "email": "Time:",
            "placeholder": "Select a time",
            "current_time": "true",
            "icon": "clock;far"
        }
    },
    {
        "tag": "column",
        "group": "layout_elements",
        "inner": [
            {
                "tag": "time",
                "group": "form_elements",
                "data": {
                    "name": "start_time",
                    "email": "Time:",
                    "placeholder": "Select a time",
                    "value": "00:00",
                    "exclude": "2",
                    "exclude_entry": "true",
                    "icon": "clock;far"
                }
            },
            {
                "tag": "time",
                "group": "form_elements",
                "data": {
                    "name": "current_time",
                    "email": "Time:",
                    "placeholder": "Select a time",
                    "current_time": "true",
                    "exclude": "2",
                    "exclude_entry": "true",
                    "icon": "clock;far"
                }
            },
            {
                "tag": "calculator",
                "group": "form_elements",
                "data": {
                    "name": "future_timestamp",
                    "email": "Subtotal:",
                    "math": "({current_time;timestamp}/1000)+86400",
                    "decimals": "0",
                    "exclude": "2",
                    "exclude_entry": "true",
                    "icon": "calculator"
                }
            },
            {
                "tag": "calculator",
                "group": "form_elements",
                "data": {
                    "name": "diff_timestamp",
                    "email": "Subtotal:",
                    "math": "({date;timestamp}/1000)+({time;timestamp}/1000)-({start_time;timestamp}/1000)",
                    "decimals": "0",
                    "exclude": "2",
                    "exclude_entry": "true",
                    "icon": "calculator"
                }
            }
        ],
        "data": {
            "invisible": "true"
        }
    },
    {
        "tag": "column",
        "group": "layout_elements",
        "inner": [
            {
                "tag": "html",
                "group": "html_elements",
                "data": {
                    "name": "html",
                    "email": "HTML:",
                    "html": "<strong style=\"color:red;\">Reservations must be placed 24 hour ahead of time. Please choose a different time.</strong>",
                    "exclude": "2",
                    "exclude_entry": "true"
                }
            }
        ],
        "data": {
            "conditional_action": "show",
            "conditional_items": [
                {
                    "field": "{future_timestamp}",
                    "logic": "greater_than",
                    "value": "{diff_timestamp}",
                    "and_method": "",
                    "field_and": "",
                    "logic_and": "",
                    "value_and": ""
                }
            ]
        }
    },
    {
        "tag": "column",
        "group": "layout_elements",
        "inner": [
            {
                "tag": "button",
                "group": "form_elements",
                "data": {
                    "name": "Submit",
                    "loading": "Loading..."
                }
            }
        ],
        "data": {
            "conditional_action": "show",
            "conditional_items": [
                {
                    "field": "{future_timestamp}",
                    "logic": "less_than_or_equal",
                    "value": "{diff_timestamp}",
                    "and_method": "",
                    "field_and": "",
                    "logic_and": "",
                    "value_and": ""
                }
            ]
        }
    }
]
Datepicker
Calculator
Calculator
Conditional Logic
Form elements code
WordPress reservation/booking form that requires a reservation date of 24 hours ahead of time
WordPress reservation/booking form that requires a reservation date of 24 hours ahead of time