Dear elliot,
now I have another question regarding checkbox values.
I’m saving acf form data with ajax to postmeta, for a checkbox field with two checkboxes and values:
value, anothervalue
the data stored by acf for example if both are checked is:
a:2{i:0;s:5:”value”;i:1;s:12:”anothervalue”;}
when I reload the page, retrieving postmeta and
set $field[‘value’] to a:2{i:0;s:5:”value”;i:1;s:12:”anothervalue”;}
This is working with normal textfields but the checkboxes are not getting checked 🙁
If I save the form with the normal acf save function it works.
what am I doing wrong here? the values on the database side are the same.
Thank you and best regards,
Jan
Hi @japel
Note: Please do not create duplicate posts:
http://support.advancedcustomfields.com/forums/topic/loading-field-values-on-front-end-form/
As written in the previous thread:
In the database, the value saves as a:2{i:0;s:5:”value”;i:1;s:12:”anothervalue”;}. This is technically a string, but when WP loads the value, it converts it to an array!
When you update your value, don’t update it with a string, update it with an array.
The array should contain the values such as “value” and “anothervalue”
Let me know if you need any extra help.
Thank you elliot and sorry for the double-post. I thought you would ignore posts marked as solved, so I recreated one.