This page may contain affiliate links. Please read my disclaimer for more information.

Use A Dropdown Field Choice to Submit the Form Automatically

  |  by Chris Eggleston

Problem

This solution is handy if you need to redirect the user to a different page or website based on the selection made in a dropdown field and don’t want them to complete all fields in the form.

Let me explain the problem with a specific use case.

You have a general intake form, also known as a contact us form, and you have a specific intake form you want people to use to submit a request for a demo.

However, the problem is that people are not using the demo form; instead, they use the general contact form.

So the question is, can I redirect the user to the demo form if they select ‘demo’ in the ‘why are you contacting us’ field?

Solution

The short answer is yes, and there is more than one way to accomplish this. I will share two simple solutions in this help doc.

Option One – No Code

This solution uses all native Gravity Forms functionality and requires conditional logic, an HTML field, and a confirmation redirect.

Configuring the Form

  1. You need at least one dropdown field with a choice for Demo
  2. Conditional logic applied to all other fields to only show if Demo is not selected
  3. An HTML field with a message to be displayed only when (using conditional logic) the user selects Demo

Configuring the Confirmations

  1. A default confirmation, to be used when the user does not select Demo
  2. A custom confirmation, set up as a page or redirect to be used with the user selects Demo

See it in action

Option Two – With Code

This solution uses conditional logic, a confirmation redirect, and a jquery code snippet (provided below).

The form and confirmation setups will be the same, but there will be one difference: an additional HTML field to add the code snippet below.

Configuring the Form

  1. You need at least one dropdown field with a choice for Demo
  2. Conditional logic applied to all other fields to only show if Demo is not selected
  3. An HTML field with a message to be displayed only when (using conditional logic) the user selects Demo
  4. An HTML field with the modified code snippet below
<script>
jQuery(document).ready(function($) {
    // Replace 'input_X_Y' with the actual input ID of your dropdown
    $('#input_X_Y').change(function() {
        if ($(this).val() === 'Choice Value') { // Replace 'Choice Value' with the triggering value
            // Trigger form submission
            $(this).closest('form').submit();
        }
    });
});
</script>

Configuring the Confirmations

  1. A default confirmation, to be used when the user does not select Demo
  2. A custom confirmation, set up as a page or redirect to be used with the user selects Demo

See it in action:

Need More Help?

If you still need help, feel free to use the comments or chat options below.

If you have an active Gravity Forms license, you can also open a support ticket here.

Photo of author
About the Author
Chris Eggleston
Chris is not just a Gravity Forms enthusiast; he's a dedicated father and loving husband. As the proud owner of WP Mantis, he's on a mission to simplify the WordPress experience for site owners. He brings a unique perspective to the Gravity Forms community.

Advertisement

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments