Custom Fields
Re-Envisioned
Support MB Settings Page Metabox switch not saving when in Metabox grouping on MB settings page

  • Creator
    Topic
  • #15354
    alpha.media
    Participant

    Hello,

    We have a situation where when you clone a new group and set the toggle switch within the group, then save the MB settings page, the toggle switch value does not save in the database. However, after the first page save, once the screen has refreshed, and you save the switch again then it will save to the database. Do you have any hints, clues, or ideas as to what could be the cause? The JS console, PHP debug log, and network list show no errors. Would appreciate any help you can offer.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Author
    Replies
  • #15362
    Anh Tran
    Keymaster

    Hi,

    Did you mean ‘toggle switch’ = the group bar collapse element, or is that a switch field type?

    Can you post a screenshot/video here?

    #15369
    alpha.media
    Participant

    I can’t really post a video, but it is the switch type field. First, it’s an MB settings page and to reproduce the error I:

    • Add a new group ( i.e. add clone )
    • Set the toggle switch type field to true
    • Save settings

    After the page has saved and refreshed, it does not show the setting saved. I then set the toggle switch type field to true, save, and it saves correctly. I am trying to understand why it does not save the first time.

    #15380
    Anh Tran
    Keymaster

    Hi,

    Here is a video that I created for testing:

    https://www.loom.com/share/e519722638ed4cb299106b56ee83be8f

    Just a note that if you clone a group and if all the child fields have no values, then that clone won’t be save. That might be the case.

    #15389
    alpha.media
    Participant

    Can this be fixed or is it just something we have to live with? Also, thank you for video!

    #15395
    Anh Tran
    Keymaster

    What do you mean “can this be fixed”? It’s the default behavior of the Meta Box Group, to prevent saving empty values. It’s not a bug.

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