0

I am trying to display something like "Field A - Field B" as a title for each content created on a Drupal 7 website.

The Field A is entered manually through Drupal standard form.

The Field B is computed with the module Computed Field and it depends on Field A value (this part works fine).

Now I would like to create automatically the node title on saving with Automatic Entity Label, using Token. (This is the new Automatic Nodetitles).

Unfortunately, using [node:field_a] - [node:field_b], the computed field B value is invisible. More, if you edit the node and save it a second time, the title is OK...

It seems like the field value calculation is made simultaneously with the title generation and thus this value can not be used to generate the title. Of course, I can not tell my client to save twice, we can not say it is user-friendly...

Is there another way to build this automatic title based on a computed field?

Related questions :

How to Compute fields on the fly

What's wrong in my code for setting up entity title in a Computed Field?

On the same subject on Drupal.org :

https://www.drupal.org/node/370850

  • What about setting up a rules event to set a data value for the node title using the event "after content is saved" ? – Collins Sep 12 '16 at 19:15
  • That could be a nice idea. I will try and return for feedback. Thanks – Toki Sep 13 '16 at 13:56
  • And it works! Do you want to write the answer so you can get credits on it? – Toki Sep 13 '16 at 14:03
  • Great news! I'll add it now :) – Collins Sep 13 '16 at 15:58
1

What about setting up a rules event to set a data value for the node title using the event "after content is saved" ?

This should work...

  1. Set up a rule with the event "after content is saved".

  2. Set up the action "set a data value"

  3. Choose the title field, and use the tokens to set your value.

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.