I am using a super nodereference field instead of a regular node reference field. The super nodereference field allows you to choose which cck field you want to come up in the autocomplete search rather than just defaulting to the title like the standard nodereference.

As far as the field goes, instead of just storing a nid in the array, it also stores the value like this:

[field_noderef][0][value]=Foo
[field_noderef][0][nid]=123

I have tried passing one or both of the variables in the url like this:

/node/add/mycontenttype?edit[field_noderef][0][nid]=66604&edit[field_noderef][0][value]=Foo

I have had no luck. Am I doing something wrong or is this module just not likely to work with this field?

Super noderef is here: https://github.com/kswan/super_nodereference

Comments

gthing’s picture

Status: Active » Closed (fixed)

I totally got this to work.

My mistake was that I was formatting my link based off of what was being stored in $node variable while I should have been looking at the "name" of my input field (in the html). I ended up being able to get it to work like this:

/node/add/mycontenttype&edit[field_noderef][0][value][value]=Foo%20[nid:123]

I am actually writing this link out from a view, so it is parsing tokens from that URL. Fortunately it's smart enough to figure out what is a token and what isn't and it creates the link URL perfectly. My final URL looks like this:

/node/add/mycontenttype&edit[field_noderef][0][value][value]=[title]%20[nid:[nid]]

Where title and nid are being replaced as tokens.

Woot!

Miguel.Andrade’s picture

Good catch, I was seeking for the same thing.

Thanks for posting!