I've been trying to solve this for a while, and have had a look at some previous issues but I don't seem to be able to make it work.

My Computed Code is set to this:
$entity_field[0]['value'] = $entity->nid . '.' . check_plain($entity->title);

And my Display Code is this:-

$temp = explode('.', $entity_field_item['value'], 2);
$display_output = l($temp[1], 'node/add/new_order', array('query' => array('edit[field_order_id][und][0][value]='.urlencode($temp[0]))));

As you can see, I want to jump to a content creation form for type new_order and pre-populate the field field_order_id with the current node ID. However the link generated is this:-

http://localhost/TestSite/?q=node/add/new_order&0=edit%5Bfield_order_id%5D%5Bund%5D%5B0%5D%5Bvalue%5D%3D36

But what I want to generate is this:

http://localhost/TestSite/?q=node/add/new_order&edit[field_order_id][und][0][value]=36

A little confused so any help much appreciated:)

- Michael

Comments

Miguel.Andrade’s picture

Don't use l(). The URL is being sanitized. It breaks things with prepopulate.

(...)

or use the $query variable in the $options array....

I normally find that is easier to write the link in HTML directly.