Description
The wpforms_form_pages_footer
action is triggered at the end of the page load for the template used for the Form Pages addon.
Parameters
This action does not accept any parameters.
More Information
This action works much like the standard WordPress wp_footer
action. It will run at the end of the page load, but specifically for the wpforms_form_pages_footer
action, it will only fire on the form page template.
This is especially useful if you have any custom JavaScript for the template used with the Form Page addon.
Source
wpforms-form-pages/src/Frontend.php
Examples
The example below will show you how to disable past times from a time picker inside your Form Pages form.
/** * Action to be called once Form Page has completely loaded * * @link https://wpforms.com/developers/wpforms_form_pages_footer/ */ function wpf_dev_form_pages_script() { ?> <script type="text/javascript"> // Find out the current time var now = new Date(); // Take that current time and round it up so we have an even number on the interval now.setHours( now.getHours() + Math.round(date.getMinutes()/90) ); // Run only on form ID 999 field ID 8 window.wpforms_999_8 = window.wpforms_999_8 || {}; window.wpforms_999_8.timepicker = { forceRoundTime: true, // Disable any times that have passed already and return the new time selections minTime: now.toLocaleTimeString() }; </script> <?php } add_action( 'wpforms_form_pages_footer', 'wpf_dev_form_pages_script', 30 );
Related
Article Reference: How to Add JavaScript to a Page When Using the Form Pages Addon