Big issue with cloneable fields

Support MB Group Big issue with cloneable fields

Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #46273
    YasmineYasmine
    Participant

    On my frontend form and in my admin, it no longer recognises that the field is valid on all cloneable fields. I have a few fields that are required and there were no issues, but it seems all of a sudden there is a big issue.

     //Likely syntax errors as I copied and pasted relevant parts from complex form
    function the_research_form( $meta_boxes ) {
        $prefix = '';
        $is_admin = (is_admin() && (current_user_can('administrator') || current_user_can('admin_limited') || current_user_can('acume_team')));
        $required = true; 
    	$logic = 'and';
        if ($is_admin) {
            $required = false;
    		$logic = 'or';
        };
    
        $meta_boxes[] = [
            'title'      => __( 'Academic: Research Summary', 'your-text-domain' ),
            'id'         => 'academic-research-summary',
            'post_types' => ['research'],
            'tabs'       => [
                'page_1'  => [
                    'label' => 'Get Started', 
                    'icon'  => '',
                    'class' => 'page_1',
                ],
    
                'page_2'  => [
                    'label' => 'Purpose + Takeaways',
                    'icon'  => '',
                    'class' => 'page_2',
                ],],
            'fields'     => [[
        'name'       => __( 'Key points', 'your-text-domain' ),
        'id'         => $prefix . 'academickey_learnings',
        'type'       => 'group',
        'clone'      => true,
       'sort_clone' => true,
       'min_clone'  => 1,
        'max_clone'  => 8,
        'add_button' => __( 'Add another key point', 'your-text-domain' ),
        'class'      => 'rs_p2 repeatable-section',
        'fields'     => [   
            [
                'name'          => __( 'Learning', 'your-text-domain' ),
                'id'            => $prefix . 'academiclearning',
                'type'          => 'textarea',
                'placeholder'   => __( 'Type your insight here..', 'your-text-domain' ),
                'required'      => $required,
                'textarea_rows' => 2,
    
                'class' => 'hide-label group-fields',
            ],
    
        ],
    'tab'        => 'page_2',
    ],
    [
        'name'      => __( 'Key findings', 'your-text-domain' ),
        'id'        => $prefix . 'academicfindings',
        'type'      => 'group',
        'clone'     => true,
       'min_clone' => 1,
        'max_clone' => 10,
        'tab'       => 'page_3',
      'sort_clone' => true,
        'add_button' => __( 'Add another finding', 'your-text-domain' ),
        'class'     => 'rs_p3 repeatable-section',
        'collapsible' => true,
          'default_state' => 'expanded',
        'group_title' => 'Finding ({#})',
        'fields'    => [
            [
                'type'  => 'custom_html',
                'std'  => __( 'State key finding', 'your-text-domain' ),
                'class' => 'sub-instruction-class-header',
            ],
            [
                'name'     => __( 'Finding', 'your-text-domain' ),
                'id'       => $prefix . 'academicfinding',
                'type'     => 'text',
                'placeholder'   => __( 'Key finding..', 'your-text-domain' ),
                 'class' => 'group-fields',
                'required' => $required,
                
            ],
            [
                'type'  => 'custom_html',
                'std'  => __( 'Provide quotable evidence to support your finding (e.g., statistic, percentage, observed pattern)', 'your-text-domain' ),
                'class' => 'sub-instruction-class-group',
            ],
            [
                'name'    => __( 'Evidence', 'your-text-domain' ),
                'id'      => $prefix . 'academicfinding_evidence',
                'class' => 'group-fields',
                'placeholder'   => __( 'Add quotable evidence..', 'your-text-domain' ),
                'type'    => 'textarea',
            ],
                              [
                'type'  => 'custom_html',
                'std'  => __( 'Explain why this finding matters', 'your-text-domain' ),
                'class' => 'sub-instruction-class-group',
            ],
            [
                'name'    => __( 'Explain', 'your-text-domain' ),
                'id'      => $prefix . 'academicfinding_matters',
                'class' => 'group-fields',
                'type'    => 'textarea',
                'placeholder'   => __( 'Briefly explain..', 'your-text-domain' ),
            ],
    
        ],
    ],
    
         ],
    
            'validation' => [
                'rules'  => [
      
                    'academiclearning' => [
                        'required' => true,
                    ],
                    'academicfinding' => [
                        'required' => true,
                    ],
           
                ],
                'messages' => [
          
                    'academiclearning' => [
                        'required' => 'At least one takeaway is required',
                    ],
                    'academicfinding' => [
                        'required' => 'Must state finding',
                    ],
      
                ],
            ],
        ];
    
        return $meta_boxes;
    };

    I feel I have exhausted my debugging. I have:
    - Tried without validation.
    - Removed custom js.
    - Removed functions.php disabled
    - Rolled back to the last metabox version.
    - Disabled caching plugins
    - Obviously cleared the cache between tests

    Nothing in error_log, nothing relevant in console. This used to work - any ideas??

    #46274
    YasmineYasmine
    Participant

    * I tested by reverting back to meta-box-aio-1.29.0.zip - not to Version 5.9.0 ....

    #46275
    YasmineYasmine
    Participant

    Hi - I can restore a backup of the last metabox but there have been loads of database changes using cloneable groups, taxonomies, other custom fields. Will it work if I revert back??

    #46284
    PeterPeter
    Moderator

    Hello Yasmine,

    I'm sorry about the experience you have. We acknowledge that there is an issue with the cloneable group field in the new version. You can try to use version 1.29.0 on your site and check the issue again.

    #46289
    YasmineYasmine
    Participant

    Reverting back to AIO 1.29.0 did not fix it, but reverting back to 5.9.11 did

    #46290
    GregGreg
    Participant

    Same problem here regarding required cloneable fields. I do not need to downgrade, but I do need to disable the required option for subfields.

    #46291
    YasmineYasmine
    Participant

    Greg, I tried disabling every required field and removed all validation, but it still does not work. Apparently the workaround is to save all the clones as empty until the fix next week. Apparently also there will are no database issues caused by rolling back to 5.9.11

    #46310
    digitaalitoimistodigitaalitoimisto
    Participant

    key_value metabox is also broken, problem with cloning in code, perhaps related.

    #46318
    Roderick GeisRoderick Geis
    Participant

    I am also experiencing issues with the clonable feature. My case is that when the max clone is set to 2, then the "Add More" does not appear.

    My values are also shifted so if I were to manually fix this bug using JS, then the first record is not saved, but the second is. Not sure if this one is related, but it has been happening for me for a while.

    #46319
    YasmineYasmine
    Participant

    I don't think MetaBox read the replies in threads (my experience - anyway) . I think better to open another ticket so they are sure to see these

    #46377
    PeterPeter
    Moderator

    Hello,

    Please update Meta Box and MB extensions to the new version and recheck the issue.

    Let me know how it goes.

    #46387
    Roderick GeisRoderick Geis
    Participant

    Hi Peter,

    No luck. I was also able to recreate the issue on another dummy website.

    #46389
    YasmineYasmine
    Participant

    Hi Peter.

    I upgraded from 5.9.11 to 5.10.1 and 1.29.0 to 1.30.1 in a staging site and unfortunately the issue still there.

    But when only upgrading the Meta Box AIO to 1.30.1 - issue not there (although it starts clone count at 0 rather than 1). But no issue with save. So it is definitely it was definitely introduced by the Metabox 5.10. The 1.30.1 is just doing something strange to the clones but I don't think the core issue

    Thanks,
    Yasmine

    #46433
    PeterPeter
    Moderator

    Hello Yasmine,

    Can you share a screen record of the issue with validation for the cloneable subfield when you use Meta Box 5.10.1? I test your code on my demo site and the validation (required) works properly for the cloneable subfield, screenshot https://imgur.com/zxjvP8L

    #46434
    YasmineYasmine
    Participant

    Thank you for testing! I deleted that staging site. But the issue was when trying to save the values (so when it is validated, it will not save as it if thinks there are no values - when there are values). If you don't have that as an issue on your demo site, I will set up another staging to show you

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.