'Hidden' Field type with 'std' value does not get saved in clone
- This topic has 4 replies, 2 voices, and was last updated 1 year, 1 month ago by
Codog.
-
AuthorPosts
-
February 1, 2025 at 11:18 PM #47565
Codog
ParticipantHi 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!
February 3, 2025 at 10:47 PM #47577Peter
ModeratorHello
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 valuefor the group field and recheck this issue. Let me know how it goes.February 4, 2025 at 4:42 PM #47584Codog
ParticipantHi 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!
February 4, 2025 at 11:27 PM #47589Peter
ModeratorHello,
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.
March 4, 2025 at 7:03 PM #47772Codog
ParticipantAfter further investigation this was a bug at my end. You can close this ticket 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.