I have a webform select field called tour
and I have set up an email to go out, using the default template:
Submitted on [submission:date:long]
Submitted by user: [submission:user]
Submitted values are:
[submission:values]
The results of this submission may be viewed at:
[submission:url]
When the email goes out, it sends the key
(nid):
Tour: 8349
rather than the value
of the option:
Tour: 10-Jan-16 - Awesome Tour
I have tried the following tokens:
[submission:values:tour:label]
[submission:values:tour:value]
[submission:values:tour:withLabel]
I am looking for the proper token to output the value in the key/value pair of a select field.
For the tour
field, I am replacing the options via a hook. I only mention this step for completeness sake as I don't think it has any impact on my issue.
function MODULE_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'FORM_ID') {
// get all tours
$query = db_select('node', 'n');
$query->fields('n', array('nid', 'title'));
$query->condition('n.type', 'tour');
$query->join('field_data_field_tour_type', 't', 't.entity_id = n.nid');
$query->fields('t', array('field_tour_type_value'));
$result = $query->execute();
// group by tour type
$options = array();
while ($row = $result->fetchObject()) {
// tour type 1
if ($row->field_tour_type_value == 1) {
$options['Type 1'][$row->nid] = date('d-M-y', strtotime($row->field_event_date_value)) . ': ' . $row->title;
}
// tour type 2
else if ($row->field_tour_type_value == 2) {
$options['Type 2'][$row->nid] = date('d-M-y', strtotime($row->field_event_date_value)) . ': ' . $row->title;
}
}
ksort($options);
// set the tour options correctly
$form['submitted']['tour']['#options'] = $options;
}
}