Closed (duplicate)
Project:
Webform
Version:
7.x-4.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Oct 2012 at 18:52 UTC
Updated:
9 Aug 2013 at 00:16 UTC
Related issue: #300075: Introducing %value (previously %submitted) token to load submitted values
With 4.0-alpha6, I noticed Webform now uses Tokens for submission data in the confirmation page, which is nice.
But, the absence of this feature has persisted since Drupal 6. Let's have it so we can reference values on our components from the components on previous pages of a multipage webform. Specifically, the new built-in component type: markup. It would be helpful for many people to have the ability to insert data from previous pages in a multipage webform.
Comments
Comment #1
cmarcera commentedIf I understand this right, this is also something I'm looking for.
I need to take users' answers from previous webform pages and use those results to create new questions:
e.g.
A or B? B
C or D? C
E or F? F
G or H? H
-next page-
B or C?
F or H?
Comment #2
dwieeb commentedYou can sort of simulate that functionality with Conditionals in 4.x.
Here is an example of the functionality I was trying to describe:
Textfield (form key: name): Name? dwieeb
-next page-
Markup (form key: markup): Hi, dwieeb! Please also fill out your e-mail.
E-mail (form key: email): E-mail? dwieeb@gmail.com
The markup component would have text like "Hi, %value[name]! Please also fill out your e-mail." for example.
So previously submitted values would be tokens that are available for use.
Comment #3
cmarcera commentedI attempted this with the following:
Type: Select Options
Key: choice_1
Options:
option1|Option 1
option2|Option 2
- next page -
Type: Select Options
Key: choice_2
Options:
option3|Option 3
option4|%value[choice_1]
It simply outputs (literally) %value[choice_1], not a token value.
According to the available token values, I thought %post[choice_1] might work, but that doesn't return anything.
Comment #4
diwant commentedI tried using [submission:sid] but the token $data array does not have an entry for the key 'webform-submission'.
The internet seems to think a hook_form_alter is the way to go, since there you can access $form_state['values']['submitted'] that seems to store a flattened tree of the values the form will save, $form_state['storage'] (and $form_state['storage']['submitted']) where quicksketch is storing things between pages (I don't know if he wants us to get at this array, it looks like it's buffer only).
I am hoping I've overlooked something and that there's a way to get at this without writing code. Anyone have any further direction?
Comment #5
diwant commentedI just noticed that I'm trying to use the submission tokens from a Markup Webform component, but that component never gets the $webform_submission object (Line 75, Function _webform_filter_values, in the markup component file 'markup.inc' in the components folder, 4.x-alpha6.)
Perhaps there is a special webform component for this that someone knows about?
Comment #6
quicksketchMarking duplicate of #1672890: Access submission data tokens from earlier pages in markup components.
There is information in that issue to alternatives, including Webform Bonus which has a "Summary" component which might do the job.
Comment #7
diwant commentedOk thanks!