Forums / Setup & design / How to output specific fields from a form in an e-mail?

How to output specific fields from a form in an e-mail?

Author Message

Espen R

Friday 06 January 2006 3:53:35 am

What is the syntax to output the collected information from a specific field from a form into a feedback e-mail?

I've seen the example on how to just loop through all the attributes but I need to lay out the e-mail in a special way so I need to access each individual attribute.

Any assistance would be very appreciated since I am quite new to eZ.

Esteban Rodriguez

Friday 06 January 2006 7:25:11 am

Hi Espen,

You can access the collected information in the $collection.attributes array.

To find exactly what attributes each element in this array has, you could use the following code

{section name=Attribute loop=$collection.attributes}
{$Attribute:item|attribute(show)}
{/section}

in the template for the collectedinfomail (most probably in the override/templates/collectedinfomail dir of your site design).

This will get you the list of attributes printed in the email you'll get from the information collector form.

hope it helps,

I have great faith in fools; self-confidence my friends call it.

http://presencia.net

Espen R

Monday 16 January 2006 5:12:54 am

Thanks. Being new to eZ and also not a coder, it was a bit hard to grasp at first. After a while I found out that you can use the syntax as in the following example:

<b>{$collection.attributes[2].contentclass_attribute_name}:</b> {$collection.attributes[2].data_text|wash}<br />
<b>{$collection.attributes[3].contentclass_attribute_name}:</b> {$collection.attributes[3].data_text|wash}<br />
<b>{$collection.attributes[4].contentclass_attribute_name}:</b> {$collection.attributes[4].data_text|wash}<br />

This will list the <b>attribute names</b> of attributes number 2, 3 and 4 (actually 3, 4 and 5 since the first is 0) and then the <b>attribute contents</b> of each.

Maybe obvious to most people..