Drupal 7 Fields - how to associate fields to each other?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
spessex's picture

Is there a way in which to associate fields in Drupal 7?

For example I have two content types (1) is a client information form that has the client's business name and all the details of all the relevant persons we deal with from that company (there could be up to 40+ people) i.e their tel numbers, email addresses, etc and (2) is a client job form which details a specific job (we could do 100's of separate jobs just for the one company).

Say I have three fields of interest in (1) the client information form which include forename, surname and telephone number, is there a way to pull through to the (2) client job form content type the same information without having to re-type it? For example I'd like it that if I try need to add John Smith's telephone number to the Job Form it automatically pulls it through when it knows I have selected the John and Smith fields, as opposed to having to re-type it again into another field a second time (as I would have already added this to the Client Information form).

Comments

I think I need something like

spessex's picture

I think I need something like http://drupal.org/project/dependent_fields but for D7. Is anyone aware of anything like this?

Why duplicate content?

zorbtrauts's picture

Why don't you just have a field on the job that references the person?

Have you looked at entity

Spark_man's picture

Have you looked at entity reference?

What they said.

Bob Newby's picture

What they said.

Useful link

Thank you. Entity Reference

spessex's picture

Thank you. Entity Reference did the job!

One last question. If I'm collecting a name should I divide this up into two separate field i.e Forename and Surname or just one field to collect the the full name? The reason I ask is that I would have thought it would be best to have separate fields however when using something like Entity Reference is there a way to join these two fields together in some way Forename + Surname to create some association so when I then Entity Ref their names they come as one as opposed to having to reference them separately i.e. John and then Smith as opposed to searching John Smith?

Field Collection

spessex's picture

Found out exactly what I need and it was the 'Field Collection' module. See http://drupal.org/project/field_collection.

This enables you to collect the Forename and Surname under one collection field but still as separate fields and then add this as an existing field from any other content types you create.