Home Forums General Issues Auto populate fields based on selection


Auto populate fields based on selection

  • Hello to all,

    I have a few questions and maybe someone of you could help me and point me to right direction. I have to say that I’m new to ACF, but I have done some amazing things with it, so I understand have its works mostly.
    Using ACF and CPT I have created post type where I can create Events. Now, the thig is I have stuck on finding a way how to autopopulate some fields.
    I have another ACF fields group and CPT post type where I can add places that have events.
    The question is that, is there any way I can auto populate other fields based on, lets say club I select? Like, phone number, adress, etc.

    I don’t ask anyone to write a code for me, just to point me in the right direction (tutorial/documentation) how can I do that.
    P.S. Sorry for my English, its not my native language.
    Thanks 😊

  • There aren’t any tutorials or a lot of documentation on doing exactly what you want. I used to have examples of doing this, but that was before the new JS API in ACF. All I can do is point you in the right direction.

    This all needs to be done using JavaScript and the ACF JS API.


    Best source of AJAX information for WP:

    This is one of my old examples, it will not work. ACF no longer has the acf.ajax object, so you need to do that yourself. Most of what I do for reading and setting fields can now be done using the ACF JS API.

    This is another example that works with ACF now, however, the only change I made to get this working was to do the AJAX request differently, while I left most of the rest the same. All of the getting and setting of fields could have been done using the ACF JS API, I just did not realize this at the time. This could be done much better using the API.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Auto populate fields based on selection’ is closed to new replies.