'Hidden' Field type with 'std' value does not get saved in clone

Support MB Group 'Hidden' Field type with 'std' value does not get saved in cloneResolved

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #47565
    CodogCodog
    Participant

    Hi there,
    I have been trying with no joy to get a hidden field type with a standard value to save with a group sub-field clone like this:

    
    [
    'id'        => 'field_id',
    'type'      => 'hidden',
    'clone_default' => true, // Always clone with the 'std' value
    'std'       => 'testing', // Hidden standard value
    ],
    

    I can see the hidden field in the DOM with the std value as above like this:

    <div class="rwmb-input" data-clone-empty-start="0"><input type="hidden" id="group_fields_field_id" class="rwmb-hidden" name="group_fields[1][field_id]" data-default="testing" data-clone-default="true"></div>

    But the data-default="testing" IE: The "std" value never gets saved in the serialized data for my MB Group Field clones?

    I am assuming this is a bug? Or am I missing something?

    I look forward to your response!

    #47577
    PeterPeter
    Moderator

    Hello

    I try to reproduce the issue but don't see that on my site. The default value of a hidden field in the cloneable group entry is saved to the database as well. Here is the sample code:

    [
        'name'              => __( 'Group', 'your-text-domain' ),
        'id'                => $prefix . 'group_pd0few9tv1o',
        'type'              => 'group',
        'clone'             => true,
        'fields'            => [
            [
                'id'              => $prefix . 'hidden_z66lqr03m5k',
                'type'            => 'hidden',
                'std'             => __( '123asdf', 'your-text-domain' ),
                'clone_default'   => true,
            ],
        ],
    ],

    I suggest you enable the setting Clone default value for the group field and recheck this issue. Let me know how it goes.

    #47584
    CodogCodog
    Participant

    Hi Peter,
    thanks for getting back to me. The result is still the same for me. I see no errors in my debug.log or browser console. I did forget to mention that my hidden cloneable field is also within an MB Frontend Form. Can you reproduce the issue in that context?

    Thanks!

    #47589
    PeterPeter
    Moderator

    Hello,

    Can you please export the field group to a JSON file and share it here? If you use the code to register the custom fields, please share all the code that you are using. And share a screen record that demonstrates the issue. I will try to reproduce the issue on my end.

    Thank you.

    #47772
    CodogCodog
    Participant

    After further investigation this was a bug at my end. You can close this ticket 🙂

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