Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    What code are you using for this specific case? Also are these just regular checkboxes or are they the taxonomy version? Asking because each that’s getting checked should be getting saved one way or another, so that when a user goes back in to edit, all the previous checked ones would still be checked.

    Thread Starter David Gewirtz

    (@dgewirtz)

    This is for options (in my case, giving levels for donors). The option allows the non-profit to choose from a set of giving levels (i.e., 20, 50, 100, 100 bucks, etc). If they choose, say, 20 and 100, we want to make sure that 20 and 100 are shown the next time they come to the settings page.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    doesn’t change my question about the code used, because the field types aren’t different dependent on the place the fields are used, whether it be on a post, on an options page, or as term/user meta. If the values aren’t persisting, then something is not right, because they should be.

    Thread Starter David Gewirtz

    (@dgewirtz)

    I need to override the values that would have been saved by the form because I have pre-existing data that needs to be filled in. I’m using this to override the data that might have been saved by CMB2:

    add_filter('cmb2_override_' . $field_id . '_meta_value', 
            $handler_function_name,
            10, 4);

    Works fine for scalar values like the select in a select field, but I’m not sure what to send back or set for a field with multiple selections.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    if I recall right, it saves a serialized array in those cases. Worst case, set up a second option configuration that you don’t override yet and observe how it saves those, then recreate for your override version.

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

The topic ‘How to fill multiple checkboxes with values’ is closed to new replies.