Is there a way to make parts of the response text printed in the mail, conditional to a selected value?

Like
if %value[key] = "Male" print "Mr." else "Mrs."
with PHP?

A use case:
In German, the (formal) salutation's conjugation depends on the addressee's gender.
By making text-snippets conditional to a certain value, I could print the appropriate saluation (a whole sentence) to be followed by the name.

Would appreciate some help / instructions.
Thanks a lot!

Comments

quicksketch’s picture

This isn't possible through the user interface, but you can create a template using PHP by following the instructions in THEMING.txt.

Makku01’s picture

how can I do this? how should the php look like?
i have something like this:

<?php 				
if ($value[signatur_field][signatur] == "Ja") {echo "yes";} else {echo "no";} ?> 

but it does not work! in the old version of webform it was no problem there it was like:

<?php 				
if ($temp_submission->data[4]['value'][0] == "Ja") {echo "yes ";} else {echo "no";} ?>

any help from your side?

quicksketch’s picture

I do not provide support for writing custom code in the Webform queue.

quicksketch’s picture

Status: Active » Closed (fixed)
mepperly’s picture

Issue summary: View changes

I realize this is a development thread, but I have been searching for a while and can't figure out a good place to ask this.

Could someone direct me to where to find out how to write this in the UI?

My safe_key|Human Readable is add|Subscribe, I want it to return "add" because of a listserv requirement.

My previous code was: [submission:values:action:nolabel], which was returning the Human Readable "Subscribe" but my mail program requires that we use "add".