I have created a block that is to print out the currently displayed webform submission. The problem is that it does not pickup the submission id from the url. It is always displays submission id 11 regardless of what submission you are looking at. Can anyone tell what the problem is how to fix it?

The Details: this is for Drupal 7.19 and using views. My block is set up the following way:

Contextual Filter: Content Nid
Filter: Content NID = 33
Fields: Content NID
        Web submissions: Sid
        Global Custom Text

In global custom text I try and read the nid and sid fields using tokens. The block is only displayed when you view a submission of a specific webform (in this case: webform with node id 33).

Please help as I am desperate here.


  • Not sure what context the block is being displayed in. Current user? Current page (which won't work unless current page is the webform)? Need much more detail.
    – Triskelion
    Mar 1, 2013 at 17:28
  • I add more detail to the description to hopefully answer your question.
    – user5013
    Mar 1, 2013 at 18:40
  • Your display is in a block. Where do you display the block? On what/what type of pages? That is the context, and governs how you would use a contextual filter. Content:nid is the nid of the empty form, not the nid included in the submissions table. Do you have a relationship established between the two tables? If you look in the webform_submissions table, how many submissions to you have, and is sid=11 one of the submissions for the webform at nid=33? How are you using the Global:Custom Text field? What exactly are you putting in that field, and how do you expect it to behave? More detail!
    – Triskelion
    Mar 1, 2013 at 19:34
  • I answered that question about where the block is being displayed - on the page you view the submission. Therefore the nid and sid are viewable in the url. So if on node/33/submission/14 you would see the block. The block should be picking up the two values (it is picking up the nid). I do have a submission with sid=11 and that is the one it is always selecting even though I am viewing sid 14 the global context field contains: <a href="/fillpdf?fid=40&webform%5Bnid%5D=[nid]&webform%5Bsid%5D=[sid_1]">Create a PDF</a> As you can see I am using tokens for substitution.
    – user5013
    Mar 1, 2013 at 22:04

1 Answer 1


OK. I see the problem. The submission will be for only one node, so all you need to get the information is the sid. The nid you are looking at is not the nid in the webform submission record. (You will understand in a moment.)

First, delete both the contextual filter on Content:nid and the filter on Content:nid.

Then create a contextual filter using Webform Submission:sid. Under 'When the filter value is NOT available', select Provide Default Value > Raw value from URL, and set the Path Component to 4.

Now to get the correct nid value, you need to create a Relationship on Webform submissions: Node, and check 'Require this relationship'. Now go back to your fields, and edit the Content:nid field changing 'Relationship' to 'Webform Node', and save. Your field should now display as '(Webform Node) Content: Nid (Nid)'. This is the nid found in the Webform Submission record.

Save your view, and you will get the correct values in the block display. I don't know about the token replacements, but it looks like it should work. If not, the Views PHP module will be able to do it without the tokens, using the $row values directly from your view.

Good Luck.

  • Thanks-you for the clear well written explanation. I will give this a try and let you know how it works out. It is weird that what I had before did work, but now doesn't. I don't understand why but your explanation on how to set it up now makes sense.
    – user5013
    Mar 4, 2013 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.