Custom Fields
Re-Envisioned
Support Meta Box Group Bug with radio buttons inside repeatable group

This topic contains 5 replies, has 2 voices, and was last updated by  guwebservices 1 year, 4 months ago.

  • Creator
    Topic
  • #8626

    guwebservices
    Participant

    I have a repeatable group that contains four fields:

    1. A set of radio buttons
    2. A post field that is only displayed when radio button A is selected.
    3. A text field that is only displayed when radio button B is selected.
    4. A text field that is always displayed.

    This group is on a settings page. When I click on the “Add more” button on my settings page in the WordPress admin to add a second group, any selection that was made in the radio buttons in the first group disappears. Am I doing something wrong here or is this a bug with Meta Box?

    You can see the code here:
    https://pastebin.com/FJN85uRi

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #8628

    Anh Tran
    Keymaster

    Hello,

    When clone a field or a group, the values of that field or sub-fields will be cleared. This is the expected behavior so users can enter new values in the new cloned fields.

    In case you want to keep a pre-defined value for a field/sub-field, please set 'clone_default' => true for the field/sub-field (in this case, probably is the radio field). This parameter will auto set the std value for new cloned field.

    #8638

    guwebservices
    Participant

    Hi Ahn,

    That is really great to know, but that does not exactly address my issue. For clarity, here is the workflow of my issue:

    1. A user goes to the settings page and sees only the first “extra link” group. None of the fields in that group are filled out initially.

    2. The user selects one of the radio buttons – let’s say it’s radio B. They also add text into all of the other fields in this first group.

    3. The user clicks on the “Add more” button to display a second group.

    4. None of the fields in the second group are filled in as expected (as you noted.) However, neither radio button in the *first* group is selected now. The previously selected radio button in that first group is now unselected – this happens when the group is cloned to create the second group.

    #8641

    Anh Tran
    Keymaster

    I see. I fixed that bug 2 weeks ago. I’ve just released new version of the Meta Box plugin, please update it.

    #8655

    guwebservices
    Participant

    That is great to hear! We will update it and test. Thank you!

    #8713

    guwebservices
    Participant

    That indeed fixed it. Thank you again!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Bug with radio buttons inside repeatable group’ is closed to new replies.