1

Im facing a problem with Durpal Webform, Ive created a select field and added options like said in the description (safe_key|Readable value)

The options are like :

w|Woman
m|Man

When I submit my webform, I would like to get the key in the results ('w') or at least in the excel file when I export it. But the Drupal default behavior is to display the selected readable value in the result ('woman') ...

How can it be done ?

For me it doesn't seem like a normal behavior, since when you create an html form with a select list, you can define the 'value' attribute (in which you can put a key) and you can define the displayed value (which will not be submit). Drupal seems to use only the Readable value ...

Thanks !

7
  • "value of this field in the result" - you mean what's displayed to you, or what really is in the database?
    – Mołot
    May 19, 2014 at 13:19
  • I mean, what is displayed in the submissions tab.
    – Mathieu
    May 19, 2014 at 13:47
  • and in the excel file if I export the results
    – Mathieu
    May 19, 2014 at 13:47
  • It seems like a normal behaviour. w is a "machine name" for that option, and Woman is what's supposed to be human readable text to be displayed. Webform displays human readable texts for humans, both in form filling screens and on reports. Sounds reasonable when put like that, doesn't it? I know for a fact you can get keys in exported file, I had it done once, but can't tell how. Too long ago. And could you add what you wrote in comment to the question itself, with a note what you want to get - where do you want to get w.
    – Mołot
    May 19, 2014 at 13:52
  • Ok my bad, Webform already have an option to select what you want during an excel export.
    – Mathieu
    May 19, 2014 at 14:22

1 Answer 1

1

It is a bit of a pain. Looks like you have to do this each time, but here goes...

Go to your Webform in question...

  • Click the Results tab
  • Click the Download button
  • Open the Select List Options section
  • Under Select Keys, choose "Short, raw options (keys)"
  • Set any other options as you need and then click Download

You should have a file where the select option columns are populated with the keys rather than the values.

Your Answer

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

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