1

I have a content type book and it has a taxonomy term reference field: author

I want to enter name and surname separately for each author on node add/edit page. Name and surname together will be the taxonomy term.

If I enter John for the name and Smith for the surname the taxonomy term will be John Smith.

enter image description here

I want to display the author name as surname, name in somewhere and in some other place I want to display as full name [name + surname].

I know I can add custom fields to taxonomy terms and use the Automatic Entity Label module to combine name and surname for term name but I want to create this structure for node form without editing the taxonomy term on taxonomy term edit page.

I was using a method like this but it is useless for this case.

How can I create a name-surname structure for taxonomy terms on node form?


Note: This question is not a duplicate of "How to reference existing term if it exists or create new one if not exist via Inline Entity Form module?" ... even though they use the same image. In this question the main point is how to create a name-surname structure on node form, in the other question "how to combine creating new term and choosing existing one options" is asked.

7
  • 1
  • @StefanosPetrakis, these are not the same questions. Please re-read them...
    – herci
    Commented Mar 5, 2016 at 11:49
  • I believe it is: "Questions may be duplicates if they have the same (potential) answers. This includes not only word-for-word duplicates, but also the same idea expressed in different words." Your comment below is part of the other/duplicate question "It works good but there is a problem I couldn't solve. I selected the Inline entity form - Multiple values. There are two options: Add new term or add existing term. It's useless for me. It would be better only one option: if the entered term is already exist do not create duplicate of it and if the term is not exist then create a new term..." Commented Mar 5, 2016 at 11:53
  • 1
    OK, that makes sense too. I hope you'll succeed in making it 200% obvious that it is NOT a duplicate. And to be sure, I'd afterwards even add some other "Note" in this question like "go see there why this question is different". FYI: I saw it showing up in the vote-to-close (since duplicate) queue. It's only after I carefully digested your both questions that I noticed (and agreed with) your extra comment "it is not a duplicate". So do you (little) homework to make it way more obvious it is not a duplicate, OK? Commented Mar 5, 2016 at 21:07
  • 1
    Please QA-review the Note I added near the end of your question, and correct / enhance if needed. Same for the "other" question ... Good luck! Commented Mar 5, 2016 at 21:41

1 Answer 1

1

This definitely worked for me:

Inline Entity Form + Automatic Entity Label + Token.
I added an entity reference field to my content type, pointing to a Taxonomy Term entity and selected "Inline entity form - Single value" as the widget.
What works great is that every time you edit the term from the node edit form, the term's label changes automatigally.

Here are some snapshots.

Add/Edit Node:

enter image description here

Newly created term (vocabulary list):

enter image description here

Node view:

enter image description here

Hope it works for you too!

3
  • It works good but there is a problem I couldn't solve. I selected the Inline entity form - Multiple values. There are two options: Add new term or add existing term. It's useless for me. It would be better only one option: if the entered term is already exist do not create duplicate of it and if the term is not exist then create a new term. Do you know is it possible?
    – herci
    Commented Mar 1, 2016 at 10:32
  • Hello @herci. I just tried the following: Commented Mar 1, 2016 at 13:21
  • 1
    Edit an existing node which already has a term attached to it. I add a new term with the same name as the existing term. After clicking on the "Create term" button, I am still at the node edit page and the list of attached terms now shows two terms (duplicates). If I reload that page, or simply save the node, the two terms are merged into one. This happens in the background automatically. So, there are no duplicates created with this process. Through a 'forced' refresh of the list of terms in the edit form, or of the whole edit form, the result would be exactly like you want. Commented Mar 1, 2016 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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