Why are hidden fields ignored by conditional logic? [RESOLVED]

We want a hidden field to dictate what form fields are dispayed on the final AJAX page. But it appears that Conditional Logic is ignoring my hidden field. Below explains our setup.

I have a single-line form field that has a default input of “prequalified”. This field should never be displayed to users and its visibility is set to hidden. Its purpose is to be used to help decide what form field a user should see at the end of the form. We place this above the page break prior to the 3 dynamic form fields we want to display

Hidden Prequalified Field

At the end of our form we need to display one of 3 different messages:

  1. “Not Qualified”
  2. “Qualified for company A - D”
  3. “Qualified for company E - H”.

Gravity Forms needs to decide which of these 3 fields are displayed based on if ALL the below conditions are met:

  • If the hidden “prequalified” field conditions are met
  • the user’s preferred company does no

I expect a user to see the “Qualified for company A - D” IF their responses meet the conditional logic configured in the hidden “prequalified” field AND if they did NOT choose companies E, F, G, or H. Below are two fields and the conditional logic that decides if they display::

Qualified for company A - D

Qualified for company E - H

If a user does not meet ANY of the eligibility criteria, we then display the “Not Qualified” form field. The same conditional logic rules configured here are the same configured in the hidden “prequalified” field.

Not Qualified

Currently, when a referral does not meet the eligibility criteria, they are seeing both the “Not Qualified” field AND one of the two “Qualified for company…” fields.

We expect that only one of the three possible fields are displayed. We do not want a “Not Qualify” message and a “Qualify for company…” messages displayed at the same time.

I was able to replicate and repeat this issue. I also had this issue in preview. I removed the locations, and still had this issue. We are running GF v2.4.24. You can test this form for yourself at https://www.vantagetrials.com/test-post/

To qualify please answer as below:

  • Choose a location =
    companyA, companyB, compancyC, companyD, companyE, companyF, companyG, companyH
  • Are you between the ages of 30 – 70?
  • Are you currently dealing with sciatica pain or numbness that radiates (shoots) down behind your buttock, thigh, or leg?
    Any answer but NO
  • Where is your sciatica pain worst?
    anything but “mostly in my back”
  • Does your sciatica pain mostly affect one leg or both?
    anything but “both legs”
  • For many people, their sciatica leg pain comes and goes in cycles. If you think about this CURRENT bout of pain you are dealing with, about how long has it lasted?
    anything but “more than 1 year”
  • Have you ever been diagnosed by a doctor as having a bulging or herniated disc in your lower back?
    Any answer is fine
  • Have you ever had surgery on your lower back?
    Any answer is fine
  • Are you willing to consider a single injection for your sciatica symptons?
  • Are you currently involved in any litigation regarding your low back/leg pain, or receiving worker’s compensation?

qualified responses and companyA = display qualified - A through D
qualified responses and company E = display qualified - E through H
no qualified response = display not qualified

Can Gravity Forms use the value defined in the hidden “prequalified” field?
Are there any errors in my configuration or assumptions I have?

Thanks in advance for your help.

Hi Carlos. First, I recommend update Gravity Forms to the latest release. The version you are using is pretty old.

Next, instead of a hidden field, can you use a regular field (whatever type you need) and use the gf_invisible class on the field, to hide it visually, but still use it in conditional logic? Here is an article about how it works:

1 Like

Thanks for the reply @chrishajer and teaching me about that class!

We are updating next month when we move to a new domain and wordpress instance. We fear updating Gravity Forms on the current wordpress instance will break a custom “store-locator” plugin we had built. The plugin is critical and works great with notifications, dynamic form fields, and breeze.pm

Using a visible text field with the default value of “prequalified” didn’t work for me. I then removed the class and tried, and realized that the “prequalified” field only displays WHEN the conditions are met. So, if it never displays, the system cannot use it at the end of the form.

So, it appears these form field variables I created ONLY are used when they are displayed. The dynamic fields appear to ignore the conditional logic rules if the form field variable was never displayed.

Here is a video as I am having a hard time expressing this unexpected behavior with conditional logic. https://www.screencast.com/t/9cRm0EACcEM

Thank you.

Can you please export this form and send me the JSON file? You can see how to export a form here: Exporting a Form - Gravity Forms Documentation

Once you have the json file, please attach that to an email sent to chris@rocketgenius.com

Thank you.

1 Like

Chris, as always you rock for wanting to help. However, I ended up getting help from a great dev at Codeable who built a store-locator plugin for Gravity Forms for us. I cannot thank GF enough for introducing me to Codeable; ultimately Naim.

I am not 100% sure what he did to fix it, but he did explain what the issue was. From what I gather, the “hidden” form field was never hidden. Even if the conditional logic criteria wasn’t met, the form field stayed running in the background. So it technically met the conditions for the final form fields that tell our users if they qualify or not. Users were seeing 2 different fields, because of the “hidden” fields never really being hidden. I hope I am explaining that right.

Thank you again for taking the time to review and teaching me about the invisible class.

Thank you for the update Carlos. Onward!

1 Like