Multicheck Selected Values Problem
-
I have a custom form using cmb2. User submit information which gets then stored on related Events Calendar Pro plugin fields. All works fine and gets stored fine but the selceted values of a multicheck.
I’m doing this$cmb->add_field( array( 'name' => __( 'Special Acts', 'xtensionpress' ), 'id' => 'special_acts', 'desc' => __( 'Check all that apply.', 'xtensionpress' ), 'type' => 'multicheck', //'multiple' => true, // Store values in individual rows 'options' => array( 'Field1' => __( 'Field1', 'xtensionpress' ), 'Field2' => __( 'Field2', 'xtensionpress' ), 'Field3' => __( 'Field3', 'xtensionpress' ), 'Field4' => __( 'Field4', 'xtensionpress' ), ), 'inline' => true, // Toggles display to inline ) );
Then to save selected values to related Events Calendar field I do this
if ( isset( $sanitized_values['special_acts'] ) ) { update_post_meta( $new_submission_id, '_ecp_custom_8', $sanitized_values['special_acts'] ); }
where _ecp_custom_8 is the Events Calendar checkbox field.
When the form with the above code is run, the special_acts multicheck field is there and when submitting the form all seems to go fine: no errors, all other fields type correctly save their values to their related Events Calendar fields, but the _ecp_custom_8 field shows all the checkboxes unchecked.
I’ve tried to uncomment the multiple attribute and still no success. The _ecp_custom_8 Events Calendar field is a checkbox; its name and values match the special_acts one. Am I missing something?
- The topic ‘Multicheck Selected Values Problem’ is closed to new replies.