Hello,
I found an old issue from 2008 with information on how to pull data from a referenced node through the URL to populate a referenced webform, in my case for use in registration to an event content type.
#228622: populate a field with another one
I fully understand how the URL works to pull the data, and how to use $get[key]. What I do not understand is how (specifically where) I modify the Reference URL that is added to the bottom of the event content type to pull the required data over to the webform.
Would someone be able to explain or direct me to an issue or piece documentation in the knowledge base that shows how to modify the path on the Node Reference. I apologize if this is the wrong place to ask this question. Please let me know if it needs to be in the Node Reference URL Issue queue.
Many thanks!
Comments
Comment #1
quicksketchAssuming that you're just using the normal formatter for Node References (a link to the node in question), you can do this by overridding theme_nodereference_formatter_default() in your theme's template.php file.
Comment #2
CrashNet commentedThanks for the quick response quicksketch. I'm afraid I may need a little more handholding on this one. Would overriding that function also affect the other node reference links?
I took a look at the code and am a little confused as to how it actually functions.
Thanks again for the help.
Comment #3
CrashNet commentedWould anyone be able to provide a little more in-depth assistance with this request? Thanks!
Comment #4
quicksketchI don't provide support on custom coding in the issue queue.
Comment #5
CrashNet commentedNo problem. Please let me know where to post this question to receive a response. Thanks.
Comment #6
quicksketchMaybe IRC or Drupal StackExchange to ask your questions.
Comment #7
rodrigo21 commentedHello Crashnet,
Did you finally found a solution for this issue. I have been struggling to find and answer (for a non developer) on how to pre-populate a CCK field, other than the title, base on the referenced node values.
Any help is welcome, many thanks.
Comment #8
sonicthoughts commentedI'm reopening this as I have the same question. I also asked here: http://drupal.stackexchange.com/questions/136799/how-do-i-pass-a-nid-to-...
Use Case: I have a content type called "Team" which contains an email address. I have a view that creates a link to create a webform to contact the Team member and prepopulate the email address in a hidden field.
The Team member does not have a user profile. I do not want to pass the email to the webform url since that would expose it. I do understand how to pass a value to a webform. I want to avoid maintaining a custom module.
Issue: I hoped I could pass the Nid of the content entity and use an entity token to "lookup" the email as a default, hidden field and use that to generate the webform. I'm sure I'm missing something fundamental (please don't down the question ...)
Question: If I can get a token such as [current-page:query:nid] from the URL, how do I use that to get the email field [node:field-email] for say Nid=5? Should token chaining something like [current-page:query:nid:field-email] work? I can't seem to find good documentation on token reference chaining - that would be very helpful.
Installed D7.33, Token, Entity Token, Entity Reference.
I have viewed several similar cases that do not apply: How to pass a token to Webform from a node relationship? referencing/linking to an entityform and passing nid/other field information through the URL Creating a token for the image field file path with node reference nid How to pass a token to Webform from a node relationship?
Note: I found this module, but not sure if it is necessary: https://www.drupal.org/project/aet
Comment #9
danchadwick commentedBeyond telling you that you can use tokens in the default for webform components, I don't have any more help for you. If you can access a token that contains the e-mail address, then you can put it into the component. It would seem likely that some custom programming will be needed for this. Best of luck.