Validate Value not working with Gutenberg

Currently a known issue with ACF and Gutenberg:


Write specialized JavaScript in functions.php or one of the include files that adds a click event on the publish button which will stop the page from saving when a validation error exists and gives the user an alert letting them know what to change.

add_action('admin_footer', 'update_fields');
function update_fields()
    global $pagenow;
    echo '<script>
    jQuery(window).on("load", function() {;
    //If homepage or foundation home page
    //Check slider for anything that's not mp4 videos, give error and don't let submit
    if ( ('post.php' === $pagenow && isset($_GET['post']) && 'page' === get_post_type($_GET['post']) && $_GET['post'] == 53) || ('post.php' === $pagenow && isset($_GET['post']) && 'page' === get_post_type($_GET['post']) && $_GET['post'] == 141)) {
        if($_GET['post'] == 53){
            $sliderName = "main_slider";
            $sliderName = "main_slider_foundation";
        echo '
		// When click update, check that 
		// Checks if cat is selected when publish button is clicked
		jQuery( "body" ).on( "click", ".editor-post-publish-button", function( e ) {
			var slider = $("[data-name='.$sliderName.'] [data-name=video]");
			var errors = false;
			slider.each(function(i, obj) {
                var filename = $(this).find("[data-name=filename]").text();
                if (filename=="" || filename.indexOf(".mp4") !== -1) {
                    errors = true;
                alert("Please only upload mp4 videos");
                return false;
		} );
    echo '});

Advanced Custom Field custom field to select one or many Gravity Forms

This is a WP Advanced Custom Field plugin custom field to select one or many Gravity Forms. This provides a field that lets you select from a list of active Gravity Forms


This add-on can be treated as both a WP plugin and a theme include.

Plugin 1. Copy the ‘Gravity-Forms-ACF-field’ folder into your plugins folder 2. Activate the plugin via the Plugins admin page

Include 1. Copy the ‘Gravity-Forms-ACF-field’ folder into your theme folder (can use sub folders). You can place the folder anywhere inside the ‘wp-content’ directory 2. Edit your functions.php file and add the code below (Make sure the path is correct to include the acf-gravity_forms.php file)


Using the field

The field lets you pick one or many fields.

The data returned is either a Form object, an array of Form objects or false if an error occurred.

If you have selected a single form and you want to display the form on the page, you can use:

    $form_object = get_field('your_form_field');
    gravity_form_enqueue_scripts($form_object['id'], true);
    gravity_form($form_object['id'], true, true, false, '', true, 1); 


    $form_object = get_field('your_form_field');
    echo do_shortcode('[gravityform id="' . $form_object['id'] . '" title="true" description="true" ajax="true"]');

You can find out more about the gravity_form method to embed a form on a page in their documentation

If you are using the field to select multiple forms, you will have to iterate over the array. You can then use the form object as you like:

    $form_objects = get_field('your_forms');

    foreach($form_objects as $form){
        echo $form['title'];