2

I'm using the recipients="yes" option in my form, and I have a number of recipients specified in the form parameters using the pipe-separated format (eg. recipient1="somename|somevalue@example.com"). Is there a way to include just the part before the pipe ("somename") in a notification template? I can add the custom field {recipient_email} but that places both parts into the template, including the email address. I just want the first bit. Possible?

EDIT: I'm similarly struggling to find a way to pass the name value of the selected email address to the return (Thank You) page. For example, if the user chooses the second of three email address from the form's select menu and that recipient is specified as recipient2="Joe Smith|jsmith@example.com" then I want to be able to have a line of the form's Return page that says "You sent this information to Joe Smith". So far I haven't found a way, even using Stash to save a variable to the database.

Anyone have a solution to this?

1

From the documentation it looks like to get just the email you can use:

{freeform:recipient_value1}

And to get just the name you can use:

{freeform:recipient_name1}
| improve this answer | |
  • AFAIK the {freeform:xxxxx} tags are just for use in page templates. Eg, the options for my select menu in the form (where the user specifies which recipient the email goes to) are defined using: <option value="{freeform:recipient_value}">{freeform:recipient_name}</option> But using that tag in the notification template — ie. the template used for the outgoing email — simply places the tag in the email text unparsed. – RickL Mar 4 '15 at 9:02
  • Basically, I am looking for an equivalent to {freeform:recipient_name} that can be used and parsed correctly in the Notification template. – RickL Mar 4 '15 at 9:06
  • Also: Worth noting that my <option> elements are specified using the {freeform:recipients}…{/freeform:recipients} looping tag pair, rather than the individually-numbered recipient tag you referred to. Either way is valid in the form itself. But for the notification I need the email to show the name selected in the form, so specifying an individual recipient number won't work. I tried the same approach that I used in the form, using the following in the notification template: {freeform:recipients} {if freeform:recipient_selected} {freeform:recipient_name} {/if} {/freeform:recipients}… No luck. – RickL Mar 4 '15 at 9:28
  • sorry I missed that this was in the notification... don't have a fix for you. – AllInOne Mar 4 '15 at 18:38
  • There seems no easy way to do this. The recipient tags (eg. {freeform:recipient_name} are, as far as I can see, only permitted in the form itself (because they reference the form tag's parameters). I cobbled together a workaround for the Thank You page by using Switchee to analyse the {freeform:field:recipient_email} variable and spit out some text for each case, but it's rather clunky and brittle. And I can't see how to do it in the notification templates at all. (If nobody has come up with a better solution in a few days then I guess I'll post my workaround as an ‘answer’, of sorts). – RickL Mar 4 '15 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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