Just like as view field, I found it's very useful in some situations.

I think token solution is also an good replace of URL prepopulate.

dd

CommentFileSizeAuthor
Screenshot at 2012-02-03 16:55:08.png16.71 KBrogical
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jpstrikesback’s picture

Status: Active » Closed (duplicate)

Opened a new issue in the Entity Reference PrePopulate Issue Queue. http://drupal.org/node/1479268

giorgio79’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev
Status: Closed (duplicate) » Active

I think having a token selector for default values should belong to Entity Reference. :)

Jelle_S’s picture

Status: Active » Closed (duplicate)

This is a duplicate of an issue with a working patch: #1699378: Allow tokens in entity reference views selection arguments

jcnventura’s picture

Status: Closed (duplicate) » Active

No it is not.. Tokens could be used for the default value of the entity reference widgets (select, checkbox and autocomplete) with no need to bring complex views into the problem.

As it is currently, I use tokens in the help field to tell the user what he should type above.. Seems a bit dumb.

jpstrikesback’s picture

@jcnventira, you are totally right.

boabjohn’s picture

Apologies if I've stumbled into the wrong queue, but I'm still looking for clues to the simple usecase:

1. Create a text field on an ordinary node type
2. Assign a token to the Default Value (eg, [current-user:name] )
3. Save
4. Attempt to create a new node
5. In the node/add form, the token is NOT EXPANDED << that's the problem

Am I in the right place?
Got here via a long route, including a bypass at the poor old email module where there are plenty of baffled people like me:
https://drupal.org/node/1253028

Thanks in advance for a clue (or two?)
JB

rt1729’s picture

Issue summary: View changes

@boabjohn : Have you found the solution ? 'm trying to the exact same thing you told in #6.. Please let me know if you got it

attisan’s picture

same here - would like to use a token in the default value field but am having the error "There are no entities matching [token]".

any hints?

attisan’s picture

ainsofs’s picture

The solution that worked for me was to use the field_default_token module and a work around.

1. First install field_default_token
2. Then on your entity reference field use the "select list" widget
3. Then you supply your default token value and save
4. Switch your widget to "autocomplete" and voila!

It worked on Drupal 7.43 with field_default_token 7.x-1.3

pauldolphin’s picture

@ainsofs... Thank you very much for posting your solution. I had a situation where I was using an entity reference field to reference a user. I was able to use the process you detailed to have this user entity reference field to pre populate with [current-user:uid].

Weird little workaround... but worked for me. Thanks again!!!