Support

Account

Home Forums Backend Issues (wp-admin) Relationship fields populate custom fields?

Solved

Relationship fields populate custom fields?

  • I had no idea what to title this, which I suspect is part of my problem.

    A synopsis of what I’m looking for and what I have:

    I have a CPT named “Clients” and another named “Invoices.” In the Clients CPT, it holds all the client info–name, address, phone, etc.

    In the Invoices CPT, I have a relationship field called “Client Information” which I use to populate my invoice on the front-end but I’d also like to utilize it on the back-end.

    Is there any way on the back-end for the client information field group fields to populate similar fields in the invoice field group fields? For example, I have want to “repeat” the fields Client Phone Number and Client Email based on the relationship chosen (those fields in the Invoice field group would be dynamically populated based on the Client chosen in the relationship field).

    The in the Admin Columns, I can display the client information from the clients CPT on the Invoice custom columns page.

    TIA for any direction or help provided.

  • That depends on how comfortable you are with JavaScript and AJAX.

    I have an example that does almost exactly what you’re looking for. It populates a text field, a textarea field and an image field based on a selection in a relationship field. You would actually be creating a simplified version of it because you’re populating all text based fields. You can find my example here https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-fields-on-relationship

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

The topic ‘Relationship fields populate custom fields?’ is closed to new replies.