Want to select a single check box
- This topic has 6 replies, 2 voices, and was last updated 5 years ago by
arifur rahman.
-
AuthorPosts
-
April 23, 2020 at 10:05 PM #19248
arifur rahman
ParticipantHello, we want to select default only one option https://prnt.sc/s4ppih right now user able to checked two filed. we want to do that like your meta genrator select filed balue our code is
array( 'id' => $prefix .'switcher_group', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( // Normal field (cloned) array( 'name' => 'Value', 'id' => $prefix .'switcher_value', 'type' => 'text', 'columns' => 4, ), array( 'name' => 'Label', 'id' => $prefix .'switcher_label', 'type' => 'text', 'columns' => 4, ), array( 'id' => $prefix . 'select_default', 'name' => esc_html__( 'Checkbox', 'metabox-online-generator' ), 'type' => 'checkbox', 'columns' => 4, ), ), 'hidden' => array( $prefix . 'select', '!=', 'switch' ), ),
April 24, 2020 at 9:30 AM #19253Long Nguyen
ModeratorHi,
Because the field
checkbox
is inside the fieldgroup
so when we add a new group (clone) the checkbox also generated. You can drag and drop the checkbox field above the group field or delete and create a new one, see my screen record.Or change the code to
array( 'id' => $prefix . 'select_default', 'name' => esc_html__( 'Checkbox', 'metabox-online-generator' ), 'type' => 'checkbox', ), array( 'id' => $prefix .'switcher_group', 'type' => 'group', 'clone' => true, 'sort_clone' => true, 'fields' => array( // Normal field (cloned) array( 'name' => 'Value', 'id' => $prefix .'switcher_value', 'type' => 'text', 'columns' => 6, ), array( 'name' => 'Label', 'id' => $prefix .'switcher_label', 'type' => 'text', 'columns' => 6, ), ), 'hidden' => array( $prefix . 'select', '!=', 'switch' ), ),
April 24, 2020 at 7:45 PM #19269arifur rahman
ParticipantThank you for your reply but we want to achieve like this https://prnt.sc/s5868a
There will be multiple values and we will assign which one will be the selected default value.
April 24, 2020 at 9:41 PM #19271Long Nguyen
ModeratorHi,
If you want to create options for the select field in MB Builder, just type the pair
value: label
in the Choice area and Default value for default. Please see my screenshot https://cl.ly/6c6440db3804April 24, 2020 at 11:55 PM #19281arifur rahman
ParticipantHello, did you saw my message we want same like your demo builder select option did you put default value? our one is dynamic user can add the option and set this value is default then we will populate in front. do you understand my Please check our metabox builder and then click select value option
thank you
April 25, 2020 at 9:54 AM #19288Long Nguyen
ModeratorHi,
We can only set the default value for the first clone item when loaded, after that the user can check multiple boxes. However, thanks for the idea, I will create a feature request to support this case. At this time, you can pop the first value of the array to show as the default value if the user checks multiple boxes.
Thanks for your patience.
April 25, 2020 at 1:25 PM #19289arifur rahman
ParticipantHello, thank you for your message, is the online generator your team create can be the product from our metabox end or that is custom
thank you
-
AuthorPosts
- You must be logged in to reply to this topic.