Creating the form
First, we’re going to create our new form. This will be a quote form that will have multiple page breaks inside. We want to skip any pages where we’re applying conditional logic if the condition hasn’t been met.
For example, on the first page, we’re gathering some basic information from them. We use a Checkbox field to ask them if they would like to schedule a free in-person quote at the time. If they select Yes, we’re going to display the second page and ask them for some personal information. If they were to select No, we want to skip the second page altogether and jump straight to the final page of the form.
If you need any assistance in creating a form with page breaks, please check out this documentation.
Setting up the conditional logic
Now it’s time to set the conditional logic to the fields on the second page. We only want to show the Date, Time, and Address fields on the second page if they have selected on the first page that they are interested in receiving a free in-person free quote. This will save our visitors time if they are not interested so we can skip this page completely if they don’t wish a visit.
To learn more about WPForms conditional logic, please check out this documentation.
The three fields on the second page will all have the same logic set. To set up the logic, select each field and click Smart Logic. Next, toggle the switch to Enable Conditional Logic.
From the dropdown, select the question you based your fields on. For the purpose of this tutorial, our question was a Checkbox field that asks Would you like us to come out and give a quote?. So our condition is, if the answer to that checkbox is Yes, then show the field. If it’s No, hide the field.
Each field on the second page will have the same logic so you’ll repeat this step for each of those fields.
Adding the snippet
Now it’s time to add the snippet to our site.
If you need any help in how and where to add snippets to your site, please review this tutorial.
This snippet will loop through each page of your form to check and see if all fields are empty, if they are the functionality will skip that page completely and move onto the next.
Now instead of seeing a blank page in your form, they will skip page breaks if none of the fields are meant to show due to conditional logic! Would you like to conditionally show or hide the Submit button on a form based on one of your form fields? Check out our tutorial on How to Conditionally Show the Submit Button.
Action Reference: wpforms_wp_footer_end