Update breaks form block on multiple sites, have to switch to shortcode

Hello - we’ve been having an ongoing issue the last few weeks with several sites that use Gravity Forms for at least a few forms each. I’m not sure whether it was 2.7.7 or 2.7.8 that started the issue, as we’ve just come to realize how global and systemic a problem it is, but if the Gravity Forms block was used to display a form on a page, it stops working and displays some unstyled fields and a bunch of code, like this:

gform.initializeOnLoaded( function() {gformInitSpinner( 2, ‘https://EXAMPLESITE.local/wp-content/plugins/gravityforms/images/spinner.svg’, true );jQuery(‘#gform_ajax_frame_2’).on(‘load’,function(){var contents = jQuery(this).contents().find(‘‘).html();var is_postback = contents.indexOf(‘GF_AJAX_POSTBACK’) >= 0;if(!is_postback){return;}var form_content = jQuery(this).contents().find(’#gform_wrapper_2’);var is_confirmation = jQuery(this).contents().find(‘#gform_confirmation_wrapper_2’).length > 0;var is_redirect = contents.indexOf(‘gformRedirect(){’) >= 0;var is_form = form_content.length > 0 && ! is_redirect && ! is_confirmation;var mt = parseInt(jQuery(‘html’).css(‘margin-top’), 10) + parseInt(jQuery(‘body’).css(‘margin-top’), 10) + 100;if(is_form){jQuery(‘#gform_wrapper_2’).html(form_content.html());if(form_content.hasClass(‘gform_validation_error’)){jQuery(‘#gform_wrapper_2’).addClass(‘gform_validation_error’);} else {jQuery(‘#gform_wrapper_2’).removeClass(‘gform_validation_error’);}setTimeout( function() { / delay the scroll by 50 milliseconds to fix a bug in chrome */ }, 50 );if(window[‘gformInitDatepicker’]) {gformInitDatepicker();}if(window[‘gformInitPriceFields’]) {gformInitPriceFields();}var current_page = jQuery(’#gform_source_page_number_2’).val();gformInitSpinner( 2, ‘https://EXAMPLESITE.local/wp-content/plugins/gravityforms/images/spinner.svg’, true );jQuery(document).trigger(‘gform_page_loaded’, [2, current_page]);window[‘gf_submitting_2’] = false;}else if(!is_redirect){var confirmation_content = jQuery(this).contents().find(‘.GF_AJAX_POSTBACK’).html();if(!confirmation_content){confirmation_content = contents;}setTimeout(function(){jQuery(‘#gform_wrapper_2’).replaceWith(confirmation_content);jQuery(document).trigger(‘gform_confirmation_loaded’, [2]);window[‘gf_submitting_2’] = false;wp.a11y.speak(jQuery(‘#gform_confirmation_message_2’).text());}, 50);}else{jQuery(‘#gform_2’).append(contents);if(window[‘gformRedirect’]) {gformRedirect();}}jQuery(document).trigger(‘gform_post_render’, [2, current_page]);gform.utils.trigger({ event: ‘gform/postRender’, native: false, data: { formId: 2, currentPage: current_page } });} );} );

The only way to get the form to display properly again is to remove the Gravity Form block from the page, replace it with the Shortcode block, and paste the GF shortcode into the shortcode block. I doubt this is how the developers intended this to work.

Have tried turning off all non-essential plugins, but no change.

What next?


I haven’t been able to replicate this on our test sites.

I know you mentioned disabling some plugins, but have you tried running through a full conflict test, including testing with a default WP theme?

When I switched from our custom theme to a basic WP theme, I got “Error loading block: The response is not a valid JSON response.” on the Gravity Forms block, and it wouldn’t let me create a new GF block either.

Then I deactivated all plugins except GF, and the form block worked in the editor again. I narrowed that particular problem down to iThemes Security Pro, and the form worked again when only that plugin was deactivated. But switching back to our custom theme again breaks the form once more, even with iThemes Security Pro deactivated.

I rolled back GF to 2.7.7, and the problem remained. I rolled back to 2.7.6, and lo and behold, the forms worked again.

So it is clearly something to do with the 2.7.7 update that’s conflicting with something specific to our custom theme (and possibly with iThemes Security Pro as a separate issue). There are no errors in the console. I haven’t the foggiest clue where to start looking. What would you suggest next?

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