ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Can’t use a global variable in {exp:email:contact_form}?

December 22, 2008 11:10am

Subscribe [1]
  • #1 / Dec 22, 2008 11:10am

    oli-studio

    19 posts

    Hi All,

    I’m trying to set the recipients of a contact form using a user-defined global variable so the client can easily change it. However:

    {exp:email:contact_form user_recipients="false" recipients="{gv-form-recipient}" charset="utf-8"}
    (formy goodness)
    {/exp:email:contact_form}

    This throws a “Your email had no valid recipients” error. Changing from the global variable to the email address works, and printing the global variable as text inside the form also works. I also tried calling it using an embed variable

    (to call the form snippet)
    {embed="snippet/f-contact" the_recipient="{gv-form-recipient}"}
    
    (form snippet including embed)
    {exp:email:contact_form user_recipients="false" recipients="{embed:the_recipient}" charset="utf-8"}
    (formy goodness)
    {/exp:email:contact_form}

    The manual page mentions these not working in member profile templates. Should it be working here?

    TIA

    peace - oli

  • #2 / Dec 22, 2008 11:40am

    Pascal Kriete

    2589 posts

    You cannot use user defined global variables as tag parameters (as per the documentation you linked to 😊 ).

    You may want to consider an alternative such as fresh variables.

  • #3 / Dec 22, 2008 11:48am

    oli-studio

    19 posts

    Hahaha, that’s embarrassing—I actually just glanced at the code snippet and thought it was a correct example! Maybe the note needs that nice red background too 😉

    Good to know, and thanks for the link to fresh variables!

    peace - oli

  • #4 / Dec 22, 2008 12:19pm

    Pascal Kriete

    2589 posts

    Let us know how that works out for you.

    Thanks.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases