Gravity Forms JS conditional logic

I’m using Gravity Forms (1.9.9?) and I have a form that uses conditional logic on a few of the fields. I have confirmed that it’s nothing to do with the other plugins and tested using TwentyFifteen and it works just fine.

I’ve tried a myriad of different solutions but load-all-of-gravityforms-js-in-footer, provides me with at least a temporary solution. But the conditional fields still appear on load until the user interacts with the field.

The error specifically is:

conditional_logic.js?ver=1.9.9.4:221 Uncaught TypeError: Cannot read property '1' of undefined

and the conditional fields don’t work, but with load-all-of-gravityforms-js-in-footer fix:

(index):417 Uncaught TypeError: jQuery(...).mask is not a function

which makes the conditionals work after the user interacts with field.

form in question - stage.barleyandboard.com - the “Previous work date” field shouldn’t appear unless “Were you previously employed…?” question is “Yes”

If you disable the jQuery CDN feature in lib/config.php it should work for you

I tried that, and deactivated soil. No luck :confused:

In lib/assets.php:

wp_enqueue_script('sage_js', asset_path('scripts/main.js'), ['jquery'], null, true);

Change that last parameter to false

Well that did something, now I’m just getting the same:

(index):417 Uncaught TypeError: jQuery(...).mask is not a function

With Soil deactivated, too?

Yep, I deployed so you can check the link.

  • Soil plugin is disabled
  • lib/assets.php has wp_enqueue_script('sage_js', asset_path('scripts/main.js'), ['jquery'], null, false);
  • Disabled all plugins except gravity forms
  • Works fine if I switch theme to TwentyFifteen

edit: Thank you for helping Ben, got a donation link?

Completely remove Sage JS — comment out main.js and Modernizr in lib/assets.php

1 Like

Commenting out main.js in lib/assets.php does the trick. It’s just the vanilla main.js file, I haven’t added anything yet.