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

RichardLynch’s picture

I 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...

RichardLynch’s picture

Aha!

*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?...

jadowd’s picture

hmmm... 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.

RichardLynch’s picture

There is no need to hack it and implement %key.

Just make %post available for anonymous users.

That should be a trivial fix.

jadowd’s picture

Just how do you do that?

RichardLynch’s picture

Find 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.

RichardLynch’s picture

WORKAROUND:
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]

quicksketch’s picture

Status: Active » Closed (duplicate)

Thanks 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.