• Resolved olly connelly

    (@the_guv)


    I have two new pods, regular new CPTs, and am wondering how I might auto-populate fields from the first into those of the second.

    So far, I have a reference number in the POD A which I can pull from a dropdown in corresponding POD B. What I would like is for other corresponding POD fields in POD B to become auto-populated (perhaps on saving a draft, else using AJAX?) rather than having to choose from a list or search query for each field.

    … Can this be done in the UI or should I be hacking functions.php, please?

    Or, am I needlessly adding data when, in some cases, the same fields might be shared between the two pods? (In some cases I would like the option to change the data value in POD B so I guess independent fields are required there at least.)

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Interested in this as well.

    Plugin Contributor Jim True

    (@jimtrue)

    This is typically against ‘normalization’; the point of relationships is that you ‘normalize’ the content to the content-types it belongs to. You don’t re-copy that content over into the content-type you are connecting it to with a relationship, because that would de-normalize it and would be impossible to keep in sync.

    This would be considered ‘needlessly adding data, not because the same fields might be shared between two pods, but that the one pod is the ‘controller’ of the data and the other pod is connected to it through your relationship field so it can ‘use’ the data through the connection in the relationship field.

    Does that make sense?

    If it helps, redefine your question with a real-world example of what you’re trying to accomplish and what seems that you can’t do with the interface as it is now. This might be a UI issue.

    For instance: if you want to see the featured image and the name of the person in the relationship list in the back-end UI, use the List View Relationship selected in Additional Options for your Relationship Field, Format and “List View”. This will include the Featured Image and the Post Title of the record on the other side of the relationship.

    Thread Starter olly connelly

    (@the_guv)

    Hi Jim, I don’t think I presented my query very consisely, although what you say makes sense and my structure now adheres to that, which it had not.

    What I was trying to ask … is there a way I can select a relationship field in POD B that, in turn, populates other fields in common?

    What I want to do is to create a post (actually a CPT but to keep it simple I’ll say post) which in itself of course populates various fields.

    Then, I want to create a different kind of post (another CPT) which draws from teh fields of the first.

    … So anything that can help to auto-populate that second post, saving time, is what I’m after.

    As best I can tell, I need to relate each field in the second post type to that of the first, choosing from a list. I wonder if, by using a common referring integer for example, if there might be a way to have the other fields fill out automatically, else on draft save, else maybe using AJAX?

    Sorry for any confusion, I have been confused! But this is my query and thank you for your assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Auto-Populate from a Relationship’ is closed to new replies.