When creating a contenttype
with the following fields:
text (core)
integer (core)
serial_field(gets auto filled in)

Module token default value https://www.drupal.org/project/field_default_token

Result text field with default value
[field_text_text] - [field_ineger_integer] - [field_serial_serial]

On node save: the node is created but only the [field_text_text] is substituted for the right value.
the other 2 are substituted with empty.
So on which hook does token_module get it data?

The serial_field value gets created on hook_presave

Can you use tokens of the same new page that they are all created?

Comments

dave reid’s picture

Project: Token » Field default token
Version: 7.x-1.5 » 7.x-1.x-dev

Maybe a better question for the module you are specifically referring to, Field default token.

ikeigenwijs’s picture

Its unrelated of field default token i think its also so for entity auto label witch also uses token.
could you tell me when token gets its values?

ikeigenwijs’s picture

Project: Field default token » Token

The common denominator is token so changed back to token project.
I think it has to do with the order of the node construction/save order of all the different hooks/steps.

I respected the order on the page, the tokens used are only for previous fields.
Or token should do 2 runs 1 what it does now and again to fill in all the unknown tokens of the previous fields.
this would give a lot of overhead.

Im going to test this stratagy using rules triggered on entity/node save action.

dave reid’s picture

Status: Active » Postponed (maintainer needs more info)

I'm having a hard time understanding what the problem is you're trying to describe. It's hard since you're not using real token names in your description. I'm not sure if you're using Field default token or Auto entity label, or something else at this point. It would be incredibly helpful to provide clear steps to reproduce your issue from a fresh install of Drupal 7 + Token module + the minimum amount of contrib modules to demonstrate the problem.

ikeigenwijs’s picture

on simplytest.me
Used projects

token
auto_entitylabel
entity
field_default_token
serial_field

enable all mentioned projects
add in a contenttype in this order a

text field named text
integer field named integer
serial field named serial
text field result (will use tokens to get filled in with default value)

with default value tokens:
i:[node:field_integer] - s:[node:field_serial] - t:[node:field_text]
set the entity auto label as (uses tokens again)
Automatically generate the label and hide the label field

i:[node:field_integer] - s:[node:field_serial] - t:[node:field_text]

create some nodes for your contenttype
1 one "leave result empty"
2 two "leave result empty"

this on the side:
the nodes get created see content but link throug does not work with pathauto without path auto ok
the page save confirmation message is not correct
Basic page i:1 - s: - t:one has been created.

gives:
i:1 - s: - t:one (page confermation)
title is correct
result field(not correct):
i: - s: - t:

should give for the first node:
i:1 - s:1 - t:one
everywhere

i hope this makes it more clear. I added serial becouse we also use it but its not the source of the problem.

ikeigenwijs’s picture

StatusFileSize
new2.16 MB
new237.81 KB

Added a screen shot of the result when creating a node, the redirect fails, but the node is created with the correct node title.
Added a screen shot of the created node.

ikeigenwijs’s picture

Status: Postponed (maintainer needs more info) » Active

Forgot to set the flag to active...

ikeigenwijs’s picture

Title: Using tokens in fields on same new node doe snot always get filled in correctly - no value » Using tokens in fields on same new node does not always get filled in correctly - no value
ikeigenwijs’s picture