acf-dynamic-ajax-select-example icon indicating copy to clipboard operation
acf-dynamic-ajax-select-example copied to clipboard

Field keys don't match json

Open CormacBracken opened this issue 8 years ago • 1 comments

In dynamic-text-based-on-user-select's js:

// this data-key must match the field key for the user field on the post page where // you want to dynamically load additional user information 'change [data-key="field_57ab9d5905e4f"] input': '_update_user_fields', // this entry is to cause the city field to be updated when the page is loaded 'ready [data-key="field_57ab9d5905e4f"] input': '_update_user_fields'

The first key isn't found in the example json. The 2nd one is in the json, but it's the user field. Difficult to understand how this code works.

CormacBracken avatar Oct 08 '17 16:10 CormacBracken

The only place you will find the any keys is in this action. These actions cause the function to run that does the updates.

The other keys are located in the PHP file. The AJAX function returns the fields keys to be updated as part of the response array. See the function at line 50 of the PHP file in the example.

Hube2 avatar Oct 09 '17 12:10 Hube2