mail receiver and information collection

Author Message

Eric Bourgain

Friday 25 August 2006 10:41:32 am

Hi everybody,

I'm designing a form designer. Everything works fine, but with the mail.
I've a receiver chooser, so that the user can choose to whom the mail will be send. I am able to retrieve the mail, but I can't set it!

If I have something like that:

{section name=Attribute loop=$collection.attributes}{if eq($Attribute:item.contentclass_attribute.identifier, 'iag_recipient_choice')}{foreach $Attribute:item.contentclass_attribute.content.options as $option}{if eq($option.name, $Attribute:item.data_text)}
{set-block scope=root variable=email_receiver}MY_EMAIL{/set-block}
{break}{/if}{/foreach}{break}{/if}{/section}

or if I indent it:

{section name=Attribute loop=$collection.attributes}
  {if eq($Attribute:item.contentclass_attribute.identifier, 'iag_recipient_choice')}
    {foreach $Attribute:item.contentclass_attribute.content.options as $option}
      {if eq($option.name, $Attribute:item.data_text)}
{set-block scope=root variable=email_receiver}MY_EMAIL{/set-block}
        {break}
      {/if}
    {/foreach}
    {break}
  {/if}
{/section}

the mariable email_receiver is empty in the collectinformation.php file

Now, if I only write

{set-block scope=root variable=email_receiver}MY_EMAIL{/set-block}

without the loop stuff, it works fine!
I know the look is OK, it is able to retrieve the mail.

Can anyone help me? Thanx

Eric

Claudia Kosny

Monday 28 August 2006 11:05:11 am

Hello Eric

are you sure that the variable is not overwritten in the loop? You break the inner loop (the foreach) once the variable is set but the outer loop (the section loop) is still there.

Otherwise your code looks fine to me, except that I would use a foreach for the outer loop as well.

Greetings from Luxembourg

Claudia

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.