You are not logged in.
Or based on Ruud’s snippet, same with the help of a article_custom;
<txp:article_custom sort="custom_1 asc" limit="1" City='<txp:php> echo $GLOBALS["zem_contact_form"]["my-select-list-label"]; </txp:php>'> <txp:custom_field name="Email_address" default="email@example.com" /> </txp:article_custom>
Note that both, mine and Ruud’s will only return a single email address, not a list. If your idea is to return multiple addresses from multiple articles selected based on the city, and only show firstname.lastname@example.org as a fallback when no articles are found, you will need something bit different. Something like following:
<!-- has_email named variable will be set "1" in the article's container, if addresses are found. For now we set it as "0". -->
<txp:variable name="has_email" value="0" />
<!-- List articles that have "Email_address" populated and "City" matched form's selection -->
<txp:article_custom sort="custom_1 asc" Email_address="_%" limit="999" City='<txp:php> echo $GLOBALS["zem_contact_form"]["my-select-list-label"]; </txp:php>'> <txp:if_different> <txp:custom_field name="Email_address" default="email@example.com" /> </txp:if_different> <txp:variable name="has_email" value="1" /> </txp:article_custom>
<!-- Show fallback if no addresses were found. -->
<txp:if_variable name="has_email" value="0"> firstname.lastname@example.org </txp:if_variable>
Please keep in mind that Textpattern doesn’t escape LIKE operators’ wildcard syntax in the custom fields’ SQL statements. If a value passed to article_custom custom_field attribute (
custom_field="value") contains any wildcard characters (
%), those will be treated as one and not as plain text. If any of the fields used to filter the list contains (or are populated with) any of those wildcard characters, you may get unexpected results say the least.
Last edited by Gocom (2011-12-18 22:18:02)
Rah-plugins | What? I’m a little confused… again :-)
Thanks Ruud and Gocom, I used Jukka second code to return multiple addresses (one from each article).
It works great, thank you very much! :)
And ohh…I wasn’t even close with the plugin help example :/
The idea was that I got a ‘showrooms’ section and a ‘contact’ page,
and in each showroom article the client enter it’s email address.
Now when a visitor choose a showroom from the select-list in the contact page form,
it will send the email to the address that the client set in that showroom’s article.
So now it’s all dynamic, I present the list of showrooms in the contact form using article-custom and now thanks to your code I set the to_form feature to be also dynamic with article-custom, so in the end the client can update showrooms and it all be done automatically.
(Besides of the default email address which is static)
I’m using ZCR to generate the contact me form on my webpage. It’s working as expected with one exception: the select field. To be specific, it’s the only field that doesn’t come through in the email that the form sends to me. Any ideas as to why this might be the case?
I did make some changes to the plugin code itself to enable support for the HTML5 placeholder attribute, but I can’t see where anything I’ve done would have disabled the select field. Here’s a link to the edited code on pastebin so you can see the changes I made. Any help would be much appreciated. Thanks!
@ajw-art, it’s probably related to the “name” attribute value, which contains a space. Try replacing it with something without a space. This would’ve caused the same problem if you were using an unmodified ZCR ;)
@ruud Yup, that was it! Thanks a lot.
Hi to all! Is this possible?
<txp:zem_contact_secret value="<txp:title />" />
So I could receive the Title of the page that was send from.
Thanks in advance!
(PS. Sorry bad English)
ONE is LOVE
This is probably simpler than I think it is, but all my articles have a contact form and I want the subject line to be the title and/or the id of the article.
I have tried <txp:zem_contact to=“email@example.com” subject=”<txp:page_title />” label=”“> but to no avail.
This isn’t to send articles to other recipients, just to me.
Thanks in advance for any guidance.