Support

Account

Home Forums Add-ons Repeater Field Unable to input anything in the WYSIWYG editor that is in repeater

Solved

Unable to input anything in the WYSIWYG editor that is in repeater

  • Hello,

    I’m experiencing an issue where when you create a new post that has a WYSIWYG field in a repeater field you can’t edit it until you’ve publish the post.

    Best wishes,
    Eric

  • I’m not seeing any issues with this.

    Deactivate other plugins and see if there is a conflict. Look in console and see if there page is generating any JavaScript errors, this could lead you to the conflict.

  • Hi John,

    I think I found the cause of the issue just don’t know what’s causing it (no error in the console unfortunately), so if an ACF field has a conditional that is checking if the WYSIWYG text editor field contains something/nothing the issue will occur.

    Here’s my setup (should’ve provided these earlier sorry!):
    WordPress 6.0.3
    Advanced Custom Fields PRO 6.0.3
    PHP 7.4.1

    Here is the PHP code of the ACF setup:

    
    
    acf_add_local_field_group(array(
        'key' => 'group_6348ca70dcee0',
        'title' => 'News Posts',
        'fields' => array(
    
            array(
                'key' => 'field_634f750f155ad',
                'label' => 'This field is the cause of the issue?',
                'name' => 'using_a_conditional_to_hide_this_field_so_cilents_wont_tamper_with_it',
                'type' => 'text',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => array(
                    array(
                        array(
                            'field' => 'field_6348de369a480',
                            'operator' => '==',
                            'value' => '',
                        ),
                    ),
                ),
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'show_in_graphql' => 1,
                'default_value' => '',
                'maxlength' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
            ),
            array(
                'key' => 'field_6348de2a9a47f',
                'label' => 'Contents',
                'name' => 'contents',
                'type' => 'repeater',
                'instructions' => '',
                'required' => 0,
                'conditional_logic' => 0,
                'wrapper' => array(
                    'width' => '',
                    'class' => '',
                    'id' => '',
                ),
                'show_in_graphql' => 1,
                'layout' => 'block',
                'pagination' => 0,
                'min' => 0,
                'max' => 0,
                'collapsed' => '',
                'button_label' => 'Add Content',
                'rows_per_page' => 20,
                'sub_fields' => array(
                    array(
                        'key' => 'field_6348de679a483',
                        'label' => 'Content Type',
                        'name' => 'content_type',
                        'type' => 'select',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => 0,
                        'wrapper' => array(
                            'width' => '',
                            'class' => '',
                            'id' => '',
                        ),
                        'show_in_graphql' => 1,
                        'choices' => array(
                            'text' => 'Text',
                            'image' => 'Image',
                            'video' => 'Video',
                        ),
                        'default_value' => false,
                        'return_format' => 'value',
                        'multiple' => 0,
                        'allow_null' => 0,
                        'ui' => 0,
                        'ajax' => 0,
                        'placeholder' => '',
                        'parent_repeater' => 'field_6348de2a9a47f',
                    ),
                    array(
                        'key' => 'field_6348de369a480',
                        'label' => 'Text',
                        'name' => 'text',
                        'type' => 'wysiwyg',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => array(
                            array(
                                array(
                                    'field' => 'field_6348de679a483',
                                    'operator' => '==',
                                    'value' => 'text',
                                ),
                            ),
                        ),
                        'wrapper' => array(
                            'width' => '',
                            'class' => '',
                            'id' => '',
                        ),
                        'show_in_graphql' => 1,
                        'default_value' => '',
                        'delay' => 0,
                        'tabs' => 'all',
                        'toolbar' => 'full',
                        'media_upload' => 0,
                        'parent_repeater' => 'field_6348de2a9a47f',
                    ),
                    array(
                        'key' => 'field_6348de499a481',
                        'label' => 'Image',
                        'name' => 'image',
                        'type' => 'image',
                        'instructions' => '',
                        'required' => 0,
                        'conditional_logic' => array(
                            array(
                                array(
                                    'field' => 'field_6348de679a483',
                                    'operator' => '==',
                                    'value' => 'image',
                                ),
                            ),
                        ),
                        'wrapper' => array(
                            'width' => '',
                            'class' => '',
                            'id' => '',
                        ),
                        'show_in_graphql' => 1,
                        'return_format' => 'array',
                        'library' => 'all',
                        'min_width' => '',
                        'min_height' => '',
                        'min_size' => '',
                        'max_width' => '',
                        'max_height' => '',
                        'max_size' => '',
                        'mime_types' => '',
                        'preview_size' => 'medium',
                        'parent_repeater' => 'field_6348de2a9a47f',
                    ),
                    array(
                        'key' => 'field_6348de569a482',
                        'label' => 'Video ID',
                        'name' => 'video_id',
                        'type' => 'text',
                        'instructions' => 'Input the YouTube (https://www.youtube.com/watch?v=YOUTUBE_ID) or Vimeo video ID (https://vimeo.com/VIMEO_ID)',
                        'required' => 0,
                        'conditional_logic' => array(
                            array(
                                array(
                                    'field' => 'field_6348de679a483',
                                    'operator' => '==',
                                    'value' => 'video',
                                ),
                            ),
                        ),
                        'wrapper' => array(
                            'width' => '',
                            'class' => '',
                            'id' => '',
                        ),
                        'show_in_graphql' => 1,
                        'default_value' => '',
                        'placeholder' => '',
                        'parent_repeater' => 'field_6348de2a9a47f',
                    ),
                ),
            ),
        ),
        'location' => array(
            array(
                array(
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => 'post',
                ),
            ),
            array(
                array(
                    'param' => 'post_type',
                    'operator' => '==',
                    'value' => 'stories',
                ),
            ),
        ),
        'menu_order' => 0,
        'position' => 'normal',
        'style' => 'default',
        'label_placement' => 'top',
        'instruction_placement' => 'label',
        'hide_on_screen' => array(
            0 => 'the_content',
            1 => 'featured_image',
        ),
        'active' => true,
        'description' => '',
        'show_in_rest' => 1,
    ));
    
  • You can’t have a field outside of a repeater that is conditional based on a field inside a repeater.

    Well, it appears that ACF will let you do this, but it will not work correctly. This is likely causing things to go sideways.

    Conditional logic only really works when the conditions are based on parent or sibling fields. For example you could have a text field that is conditional on the repeater having any content rather than one of the repeater’s sub fields.

  • Ah true that makes sense.

    Thank you John for the explanation!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.