Support Forum
hi,
can you tell me why this is happening?
[
'name' => __( 'Datum', 'your-text-domain' ),
'id' => $prefix . 'repeater_datum',
'type' => 'date',
'class' => 'tage-datum',
'js_options' => array(
'dateFormat' => 'dd-mm-yy',
'showButtonPanel' => true,
),
'save_format' => 'Y-m-d',
'save_field' => 1,
],
...should save date as "2021-05-20"....
but the array saved in the DB looks like this.
a:2:{i:0;a:1:{s:14:"repeater_datum";s:10:"20-05-2021";}i:1;a:1:{s:14:"repeater_datum";s:10:"21-05-2021";}}
Hi Julian,
The option save_format
does not work with the group field. On the other hand, using the group which means for store data, not querying so we don't need to save to another format. We've mentioned it here https://metabox.io/create-group-of-custom-fields-with-meta-box-group/
Thanks Long Nguyen,
i see. for me it doesnt matter in which format the data are saved as long the user can has the same format in the date picker in the frontend form (metabox made from code) and in the backend (metabox made by the UI). so that means i need to edit the backend metabox with...
'js_options' => array(
'dateFormat' => 'yy-mm-dd',
'showButtonPanel' => false,
),
but this doesnt work.
what does work is to add the entire field within the js-options. what doesn't work is to add only the js-option to the existing field. whether by https://docs.metabox.io/edit-meta-boxes/or setting Custom settings like here https://docs.metabox.io/extensions/meta-box-builder/#custom-settings. how should the custom settings look like for the js-options?
thank you
Hi Julian,
If you want to use the custom settings in the Builder, please use the dot notation to apply the js_options
settings. See my screenshot https://share.getcloudapp.com/rRuG88GD
Hey Long Nguyen,
it works. thank you very very much for your help 🙂