Big issue with cloneable fields
- This topic has 20 replies, 5 voices, and was last updated 7 months, 3 weeks ago by
Peter.
-
AuthorPosts
-
August 29, 2024 at 12:27 AM #46273
Yasmine
ParticipantOn 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 testsNothing in error_log, nothing relevant in console. This used to work - any ideas??
August 29, 2024 at 12:46 AM #46274Yasmine
Participant* I tested by reverting back to meta-box-aio-1.29.0.zip - not to Version 5.9.0 ....
August 29, 2024 at 2:55 AM #46275Yasmine
ParticipantHi - 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??
August 29, 2024 at 9:55 PM #46284Peter
ModeratorHello 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.
August 30, 2024 at 1:37 AM #46289Yasmine
ParticipantReverting back to AIO 1.29.0 did not fix it, but reverting back to 5.9.11 did
August 30, 2024 at 4:27 AM #46290Greg
ParticipantSame problem here regarding required cloneable fields. I do not need to downgrade, but I do need to disable the required option for subfields.
August 30, 2024 at 4:32 AM #46291Yasmine
ParticipantGreg, 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
September 3, 2024 at 1:23 PM #46310digitaalitoimisto
Participantkey_value metabox is also broken, problem with cloning in code, perhaps related.
September 4, 2024 at 12:42 AM #46318Roderick Geis
ParticipantI 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.
September 4, 2024 at 12:45 AM #46319Yasmine
ParticipantI 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
September 9, 2024 at 10:07 PM #46377Peter
ModeratorHello,
Please update Meta Box and MB extensions to the new version and recheck the issue.
Let me know how it goes.
September 9, 2024 at 11:15 PM #46387Roderick Geis
ParticipantHi Peter,
No luck. I was also able to recreate the issue on another dummy website.
September 10, 2024 at 12:06 AM #46389Yasmine
ParticipantHi 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,
YasmineSeptember 12, 2024 at 10:46 PM #46433Peter
ModeratorHello 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
September 12, 2024 at 10:52 PM #46434Yasmine
ParticipantThank 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
-
AuthorPosts
- You must be logged in to reply to this topic.