tags:

views:

382

answers:

2

In the contact us template I want to have a dropdown with the list of offices (All offices articles are places under the same parent node, so getting the list should be fairly easy). I need a way to add the office email address (Template variable from the Office article) to the email generated by Modx's eForm. I don't want the email address to be visible in the contact us form, but a snippet fetching the article Template variable email address.

I also want a link from each offices article to the contact us form with the office preselected in the dropdown.

How should I implement this?

+2  A: 

Ok, to solve this I removed the to field in the snippet call to eform, and modified the snippet itself to exetute a function to get the to field for the email. This function takes the post variable "office" (the id of the office article) and is using the modx api to get the template variable holding the email address for this article.

Then I am returning this email address from the function and placing this into the email to field. By adding a regular link from each location article with

...?office=[~id~] 

pointing to the contact us article. Using

$_GET["office"] 

to predefine the dropdown

code-zoop
+1  A: 

You should really look into eForm. has such an action where you can put &cc=[email protected]

snippet call:

[!eForm? &formid=`feedbackForm` &to=`[email protected],[email protected]` &mailselector=`department` &tpl=`eFeedbackForm` &report=`eFeedbackReport` &gotoid=`46` &vericode=`1`!]

the form would be set up under a chunk eFeedbackForm and your dropdown selection should look like:

<p><label accesskey="s">Send To</label><br />
<select name="department" style="width: 232px">
            <option value="1">Mail1</option>
            <option value="2">Mail2</option>
    </select></p>
Austin