Thursday 20 October 2005 10:18:44 pm
Ok I finally got this to work, and it works surprisingly well. Just in case others need similar functionality I'll try to explain how I did it. First I created a form with all of the required fields:
name:
phone no: email: etc.
I added a selection attribute using the enhanced selection extension datatype from the contribs http://ez.no/community/contribs/datatypes/enhanced_selection I have 2 divisions so I put 2 options in the select box:
option1: division1 option2: division2 Lastly I added 2 recipient email addresses using the email datatype:
Recipient Division1: div1[at]company.com Recipient Division2: div2[at]company.com I override the template file content/collectedinfomail/form.tpl following instructions found at: http://ez.no/products/ez_publish_cms/documentation/customization/components/information_collection In my override template I replace this:
{set-block scope=root variable=email_receiver}
{$object.data_map.receiver.content}
{/set-block}
With this:
{section loop=$collection.attributes}
{if $:item.data_text|eq(Division1)}
{set-block scope=root variable=email_receiver}
{$object.data_map.recipient_division1.content}
{/set-block}
{elseif $:item.data_text|eq(Division2)}
{set-block scope=root variable=email_receiver}
{$object.data_map.recipient_division2.content}
{/set-block}
{else}
{* fallback to site.ini.append.php (EmailReceiver) *}
{/if}
{/section}
If you select Division1 your email message is sent to div1[at]company.com and vice-versa. The $:item.data_text is just the value of the select options, I used the |eq() operator to find the option, this seems to work perfectly but I'm not sure if there is a better way to do it. If you know of a better way please let me know. I hope this helps others. Cheers!
Pardon me while I burst into flames...
|