Conditional Logic, Required Fields and User Registration

We have a form that conditionally shows user registration fields based on radio box selections. The user registration fields are required when they are shown.

When the registration fields are hidden by conditional logic, the form does validate. I’ve added the conditional logic to the user registration feed as well.

This seems like a common issue, but I’m not finding support articles or community posts that help.

Why are conditionally hidden and required fields not validating?

Additionally, we only want to show the user registration if the visitor is not logged in. I added a hidden field that determines if the visitor is logged in as suggested here: https://gravitywiz.com/gravity-forms-conditional-logic-based-on-user-login/.

The problem is that I can’t nest the conditional logic, to show the user registration fields if the user is not logged in and the conditional radios are selected. How might this be accomplished?

Hi DCI,

When conditional logic is used to hide a field, the field and its value are removed from the form, and as such, conditionally hidden fields cannot be validated when the form is submitted.

To set up the conditional logic to show the fields, if the user is not logged in and a specific choice, like the Second Choice, is selected on the Radio button field, the conditional logic can be set up like so;

Conditional Logic Setup

I hope this helps.

Best,

Hi Samual,

Thanks for the reply! I understand that’s the way conditional logic is supposed to work. Unfortunately, the user registration fields fail validation even when hidden using conditional logic for this form and I can’t determine why. I’ve added the conditional logic to the user registration feed and the issue persists.

For the is user logged in conditional, the problem is that I’m using a “Show if Any” because the field that determines if the user registration is shown is a radio field with multiple options and sub-logic. (see attachment)

Here’s a sample of what we are looking for:

  • The radio field group has 1-6 options.
  • Radio options 1-3 show the user registration
  • Radio options 4-6 show a consent checkbox instead
  • If 4-6 check the consent checkbox, then the user registration is shown
  • Lastly, the user registration should not be shown for any radio selection if the user is logged in

The conditional logic is on a section field surrounding the user registration fields. Maybe I need to set conditional logic on a third hidden field that would determine if it’s shown. Any ideas how I can accomplish this? Do I need to use Javascript?

Attempting to solve the complex conditional logic issue, I added a hidden field named “UserRegistration”. This field is changed to true or false via JavaScript based on the radio button selections or the consent checkbox.

I then tried changing the conditional logic in the form, to show the user registration fields if the hidden field is true, but the fields are not displayed. I presume this has something to do with the Gravity Forms JS.

Any help or direction would be greatly appreciated. Or maybe Gravity Forms can’t handle these complex conditional forms?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.