Meta Box
Support Forum
Support › General › Ajax autocomplete field is not saving data
Hello ! I've created an autocomplete field that populates results with AJAX from an API. The fields is well populated : https://imgur.com/ryhJuEJ When I select a line, it's well displayed underneath the list : https://imgur.com/5eB5ZvW In the code, the value is correct : https://imgur.com/88bOc6e
But when I Save the post, nothing is stored in the database. I've tested with static data and it works fine...
Can you help me understand why ? Thanks !
OK, it works if I set this option in my field : 'sanitize_callback' => 'none',
Is there a way to display the value here after saving ?
https://imgur.com/2WhDOCN
Hello,
Does the returned data from API have the format 'value' => 'Label' like the static data? Also, the value should be in lowercase, with no special characters. Read more in the documentation https://docs.metabox.io/fields/autocomplete/#settings
'value' => 'Label'