I'm using Drupal 7, and on my Drupal website I've created a content type. This content type has 2 fields: field name, and code. I need to create another content type, and (on this content type) fields based on the data of the "Name" field of the previous content type.

For example:

  • Content type ABC: content

    Name  | Code
    AAAAA | A
    ABABA | B
    ACACA | C
  • Content type DEF: fields

    • AAAAA (widget: textfield)

    • ABABA (widget: textfield)

    • ACACA (widget: textfield)

How can I achieve this?


A better way is to use Entity reference

Provides a field type that can reference arbitrary entities:

| improve this answer | |
  • it's not what i need. I need that the label of the field become dynamic. Thank you btw. – user1814734 Feb 14 '13 at 4:04
  • @user1814734, in that case you should try hook_form_alter and alter the element titles accordingly. – niksmac Feb 14 '13 at 4:06
  • But, the dynamic label is not only for one field. For example: i have 2 content type product and invoice. Then i need to add all product name as the field label on content type invoice. So if on content type product i have iphone, ipad, ipod, then on content type invoice, the form will be: iphone: textfield ipad: textfield ipod: textfield. – user1814734 Feb 14 '13 at 4:11
  • @user1814734, if you have a relation its possible with form alter, if not its never possible or you need to write tons of if()s – niksmac Feb 14 '13 at 4:12
  • i've updated my comment above, is that possible to get result as i mention? – user1814734 Feb 14 '13 at 4:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.