Closed (duplicate)
Project:
Webform
Version:
6.x-3.11
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Jun 2011 at 21:29 UTC
Updated:
29 Jun 2011 at 03:44 UTC
For example... I have several questions like so...
How do you rate our service?
for the options, I have:
1|Very Dissatisfied
2|Dissatisfied
3|Neutral
4|Satisfied
5|Very Satisfied
While the client should see the values, the folks receiving the emails would like to see the key... i.e., the number. How can I get this, or if not, can you make it so that I can, or, if not, can I fix this, and submit the patch?
Thanks,
Comments
Comment #1
RichardLynch commentedI also need to get the value="xyz" instead of the, errr, options.innerHTML
I'm not even sure how you managed to snarf that in, though I guess Drupal form passes so much data around, it's in there somewhere...
I just want the form processing to be "normal" so that the value="xyz" is what I get. Not some wacky human-readable text.
Is there a %value[NAME] or %key[NAME] or something?
It's not listed in the tokens...
Comment #2
RichardLynch commentedAha!
*OR* just make %post available for anonymous users, so we can snag it out of there.
What is the rationale for making %post only available for authenticated users anyway?...
Comment #3
jadowd commentedhmmm... I hadn't thought about %key[name]... You are right, it's not listed in the tokens. Maybe I will just have to write my own module for that, if I don't get an answer soon.
Comment #4
RichardLynch commentedThere is no need to hack it and implement %key.
Just make %post available for anonymous users.
That should be a trivial fix.
Comment #5
jadowd commentedJust how do you do that?
Comment #6
RichardLynch commentedFind where they made it forbidden for anonymous users.
Search for $_POST, since that's where %post has to come from.
They had to add code to NOT do it for anonymous users, since $_POST is "there" by definition for a POST request, in PHP.
Comment #7
RichardLynch commentedWORKAROUND:
Suppose the name of the field you wanted is "service".
Then create a "computed" field named "service_hack" which reverse-engineers the option.innerHTML back to the value, and use %value[service_hack] in your email template.
This is a gross disgusting hack, and I've only seen the "computed" on another developer's form to make me believe it will work, but it seems like it ought to be able to be worked around that way...
It's still just totally bassakwards from what any form processor code would expect to see...
At least when (if) it gets fixed, you can just delete component service_hack and change the template to %value[service]
Comment #8
quicksketchThanks for the followup, but this is a duplicate of #749782: Select Option 'safe_key' to display in email template?, we should merge with the discussion over there.