Forums / Setup & design / Select recipient for feedback form

Select recipient for feedback form

Author Message

paul bolger

Thursday 06 January 2011 2:41:15 am

I'm trying to modify the ezwebin feedback form to allow the user to select a recipient from a list of users derived from a fetch of the user folder.

It seems to me that a way to do this would be to define the recipient in a global variable in

/full/feedback_form.tpl

and call that variable in

/content/collectedinfomail/feedback.tpl

- replace recipient.content in this code block with the variable

 {if and( is_set( $object.data_map.recipient ), $object.data_map.recipient.has_content )}
{set-block scope=root variable=email_receiver}{$object.data_map.recipient.content}{/set-block}
{/if}

So, fetching the users is easy, but how to set the variable on the form submission? Or is there a better way?

Paul Bolger

Bertrand Dunogier

Friday 07 January 2011 3:17:20 am

You can make the selected recipient a collection attribute, and make sure some kind of ID for the selected recipient is sent along with the collected data. In the feedback template, you can read the variable, fetch the associated email address, and set it as the recipient like you demonstrated with your code.

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

paul bolger

Saturday 08 January 2011 12:51:42 pm

Thanks. It's the first part I'm unclear about. How would I go about making the selection a collection attribute? I took a look at using object relations to select an object but that datatype doesn't seem to work as an information collector.

regards

Pb

Paul Bolger