MODx Community Forums
The MODx Blog
Donations
Feedburner Feeds
Documentation
Bugs & Requests
The Wiki
download MODx
plugins, modules, snippets
online demo
Jul 05, 2009, 09:08 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search via SMF
or Google:
modx forums
all of modxcms.com
web
MODxCMS.com
Forums
Help
Login
Register
News
:Read
Frequently Asked Questions (FAQ)
MODx Community Forums
»
Add-ons, Extensions & Elements
»
Forms, Form Processing & Anti-Spam
»
TV tag doesn't work in eForm email template
Pages: [
1
]
Go Down
« Previous topic
Next topic »
Print
Author
Topic: TV tag doesn't work in eForm email template (Read 934 times)
0 Members and 1 Guest are viewing this topic.
Gav
Jr. Member
Posts: 39
TV tag doesn't work in eForm email template
«
on:
Dec 04, 2008, 05:51 AM »
Hi,
I am using eForm for a fairly simple contact form on a webpage. On the form page I display two text template variables. The same page has a call to eForm. The whole page is as follows:
Code:
<h1>[*pagetitle*]</h1>
<p><b>[*haveYourSayTitle*]</b></p>
<br/>
<p>[*haveYourSayTopic*]</p>
<br/><br/>
[!eForm? &formid=`haveYourSayForm` &tpl=`haveYourSay-Form` &report=`haveYourSay-Email`
&to=`me@myemail.co.uk` &from=`no-reply@mysite.org.uk` &replyto=`no-reply@mysite.org.uk`
&subject=`Volunteer Have Your Say` &invalidClass=`invalidValue` &requiredClass=`requiredValue`
&cssStyle=`haveYourSay-Styles` &debug=`0` &thankyou=`haveYourSay-Thanks`!]
I need the values of the two TVs (as displayed on the page) to be included in the resulting email.
I have tried:
1
. placing the TV tags in the form (&tpl=`haveYourSay-Form` chunk) in hidden inputs (<input type="hidden" name="title" id="title" value="[*haveYourSayTitle*]" />), with [+title+] in the email template.
In this case I get the following error on the form page and no email:
Please correct your submission
[undefined] » Tampering attempt detected!
2
. placing the TV tags straight into the email template (&report=`haveYourSay-Email` chunk).
In this case I get the email but no output from the TV.
I assume that if a page uses a template which has a TV, then any chunks or snippets used by that page should also have access to the same TV? (I take this from para 7 of
http://sottwell.com/how-template-variables-work.html
)
I have tried using &sessionVars=`haveYourSayTitle` in the snippet call, with the but to no avail.
Anyone out there able to tell me how to do this?
Thankyou
eForm 1.4.4
MODx 0.9.6.1p2
PHP 5.2.4-dev
Apache 2.2.4
Windows Server
Logged
Gav
Jr. Member
Posts: 39
Re: TV tag doesn't work in eForm email template
«
Reply #1 on:
Dec 08, 2008, 03:31 AM »
Does nobody out there know the answer to this?
OK, let me put it another way. Can anyone tell me how to put the value of a TV (template variable) into an email resulting from a form.
If eForm can't do this, can anybody recommend another form-to-email snippet that can do this?
Cheers,
Gav
Logged
Eol
Full Member
Posts: 196
Re: TV tag doesn't work in eForm email template
«
Reply #2 on:
Dec 08, 2008, 04:32 AM »
Quote from: Gav on Dec 04, 2008, 05:51 AM
placing the TV tags in the form (&tpl=`haveYourSay-Form` chunk) in hidden inputs (<input type="hidden" name="title" id="title" value="[*haveYourSayTitle*]" />), with [+title+] in the email template.
In this case I get the following error on the form page and no email:
[undefined] » Tampering attempt detected!
Try adding eform validation control parameters to hidden field:
eform="field_text::0:Id:0"
Quote from: Gav on Dec 08, 2008, 03:31 AM
OK, let me put it another way. Can anyone tell me how to put the value of a TV (template variable) into an email resulting from a form.
Use eForm events:
Code:
function efOnBeforeMailSent(&$fields) {
...
$fields['field_name'] = $field_text;
...
}
Logged
dev_cw
Testers
Posts: 4,025
Re: TV tag doesn't work in eForm email template
«
Reply #3 on:
Dec 08, 2008, 04:57 AM »
I would use an event function for this as well. You can do all sorts of cool processing if needed by using the events. There is some good documentation packaget together with the snippet assets/snippets/eform/docs that have a good example of using events.
However, aternatively you can use a session var and declare it to use as a placeholder:
Quote
&sessionVars (optional)
Comma delimited list of $_SESSION variable names. These will be added to the list of field values before the form is displayed and can for instance be used to populate (hidden) fields. When using this parameter make sure you are not disclosing sensitive information from the session!! (a hidden field is not all that hidden afterall)
Logged
Shane Sponagle
|
[wiki] Snippet Call Anatomy
|
MODx Developer Blog
|
[nettuts] Working With a Content Management Framework: MODx
Something is happening here, but you don't know what it is.
Do you, Mr. Jones? - [bob dylan]
Gav
Jr. Member
Posts: 39
Re: TV tag doesn't work in eForm email template
«
Reply #4 on:
Dec 09, 2008, 10:01 AM »
Thanks Eol, I tried your "adding eform validation control parameters to hidden field" suggestion and it worked first time!
hidden input now like:
<input type="hidden" name="title" id="title" value="[*haveYourSayTitle*]" eform="field_text::0:Id:0" />
The only remaining issue now are that the string (TV) I'm trying to display contains <br/> tags which are not handled at all in the email, and unslashed quotes. The TV only echos up to the first quote. Need to sort that and I'm fine.
Thanks for your response too dev_cw. I think that events look worth investigating from what you say here.
«
Last Edit: Dec 09, 2008, 10:03 AM by Gav
»
Logged
TobyL
Coding Team
Posts: 1,006
Re: TV tag doesn't work in eForm email template
«
Reply #5 on:
Dec 10, 2008, 11:14 AM »
Quote from: Gav on Dec 09, 2008, 10:01 AM
Thanks Eol, I tried your "adding eform validation control parameters to hidden field" suggestion and it worked first time!
hidden input now like:
<input type="hidden" name="title" id="title" value="[*haveYourSayTitle*]" eform="field_text::0:Id:0" />
Just a reminder that the above validation rule in reality means you are not validating the input for that field at all and anyone so inclined could change the value on the browser side at will. If this poses a security threat or is simply a nuisance depends on your form and your settings but generally it is not a good idea to leave posted values un-validated.
Dev-cw's suggestion of using events can give you a more secure solution. Have a look at examples for the eFormOnBeforeFormParse event. You can write a function that is triggered by that event which fetches the content of the TV's (see the
$modx->getTemplateVarOutput
function), use
htmlentities
or
htmlspecialchars
to 'escape' any special characters in the TV values and add them to the form template. How to do the latter you will be able to read about in the many examples for the eForm events in the forum or in the eform/docs/ directory.
Logged
eForm
|
eForm support
|
eForm @ wiki
Pages: [
1
]
Go Up
Print
« Previous topic
Next topic »
Jump to:
Please select a destination:
-----------------------------
Announcements
-----------------------------
=> Important News
=> Security Notices
-----------------------------
Commercial Support
-----------------------------
=> [CS] About Commercial Support
-----------------------------
Development & Coding
-----------------------------
=> Commercial Inquiries & Bounties
=> Core Code
===> MODx Next
===> xPDO
=> Module, Plugin & Snippet Creation and Modification
=> In Development
=> Templates
-----------------------------
Add-ons, Extensions & Elements
-----------------------------
=> Module, Plugin & Snippet Usage
=> General Repository Items Support
=> Navigation & Tagging/Taxonomy
===> Wayfinder & DropMenu
=> Creating & Repurposing Content
===> Ditto
===> Jot
===> Front-end Document Management
=> Users, Authentication & Personalization
===> WebloginPE
===> WebLogin, WebSignup and WebChangePwd
=> Rich Text Editors & File Browser
===> TinyMCE
===> FCKeditor
===> MCPuck File Browser
=> Forms, Form Processing & Anti-Spam
===> eForm
=> Search
===> AjaxSearch
=> E-business
=> Polls, Calendars, Address Book and Community
=> Third-party integrations
=> Images, Videos & Podcasts
===> MaxiGallery
=> Manager, Parser & the Core
===> Backup & Versioning
===> Doc Finder
===> ManagerManager
===> PHx
=> Templates
-----------------------------
Support
-----------------------------
=> Release Support
===> 0.9.6.3
===> 0.9.6.2
===> 0.9.6.1
===> 0.9.6
===> 0.9.5 and earlier
=> General Support
===> MODx 101
===> E-Commerce, E-Marketing, Analytics & SEO
===> Hosting Experiences
===> IIS / Windows Hosting Issues
=> Documentation, Tips & Tricks
===> Documentation Suggestions & Corrections
-----------------------------
General Discussions
-----------------------------
=> General MODx Discussions
=> Webworker Lounge
=> Wishlist
=> You and Your Sites
=> modxcms.com Discussions and Suggestions
=> Off-topic
-----------------------------
International Support & Translations
-----------------------------
=> Internationalization
=> Bulgarian
===> Поддръжка
=====> Често задавани въпроси
=====> Инсталация
=====> Модули, Плъгини, Снипети и код
=====> Дизайн и Шаблони
===> Документация, Ръководства и Превод
=====> Документация
=====> Ръководства
=====> Превод
===> Общество
=====> Съобщения
=====> Представете се
=====> Представете сайта си
=====> Дискусии извън MODx
=> Chinese
=> Czech
===> Oznámení
=====> Důležitá oznámení/novinky
=====> Bezpečnost
===> Komunita
=====> Oznámení
=====> Představte se, prosím
=====> Ukázky práce
=====> Různé aneb cokoli co se jinam nehodí
===> Podpora
=====> FAQ (často kladené otázky)
=====> Instalace
=====> Moduly, pluginy, "snippets & code" (šablony zdrojových kódů)
=====> Design & Šablony
===> Dokumentace, tutoriály (návody) a překlady
=====> Dokumentace
=====> Tutoriály (návody)
=====> Překlady (lokalizace)
=> Dutch
===> Ondersteuning
=====> Veel gestelde vragen
=====> Modules, Plugins, Snippets & Code
=====> Design & Templates
===> Documentatie, Tutorials en Vertalingen
=====> Documentatie
=====> Tutorials
=====> Vertalingen
===> Community
=====> Aankondigingen
=====> Stel jezelf voor
=====> Site Showcase
=====> De stamkroeg
=> Filipino
===> Suporta
=====> Kadalasang tanong
=====> Instalasyon
=====> Moduler, Maidadagdag, Karagdagang mga Code
=====> Desenyo at Templates
===> Dokumentasyon, Mga Turo, Mga Salin
=====> Dokumentasyon
=====> Mga Turo
=====> Mga Salin
===> Kumunidad
=====> Anunsyo
=====> Ipakilala ang sarili
=====> Ang Galing ng pinoy
=====> Tsismisan atbp
=> Finnish
===> Tuki
=====> UKK
=====> Asennus
=====> Moduulit, liitännäiset, koodinpätkät
=====> Ulkoasu/Sivustopohjat
===> Dokumentaatio, oppaat ja käännökset
=====> Dokumentaatio
=====> Käännökset
=====> Oppaat
===> Yhteisö
=====> Tiedotteet
=====> Esittele itsesi
=====> MODx sivustosi
=====> Kahvihuone
=> French
===> Support
=====> FAQ
=====> Installation
=====> Module, plugin, snippets
=====> Design/Templates
===> Documentation, Tutoriels et Traductions
=====> Documentation
=====> Traduction
=====> Tutoriels
===> Communauté
=====> Annonces
=====> Présentez vous
=====> Vos sites
=====> Le Bistrot Français
=> German
===> Support (de)
=====> FAQ (de)
=====> Installation (de)
=====> Module, Plugins, Snippets & Code (de)
=====> Design & Templates (de)
===> Dokumentation, Tutorials und Übersetzung
=====> Dokumentation
=====> Tutorials (de)
=====> Übersetzung
===> Community (de)
=====> Ankündigungen
=====> Stellt Euch vor
=====> Beispielseiten
=====> Off Topic / Verschiedenes
=> Hebrew
===> הכרזה
=====> חדשות חשובות
=====> אבטחה
===> תמיכה
=====> התקנה
=====> תיעוד, מדריכים ותרגומים
=====> עיצוב ותבניות
=====> שאלות נפוצות
===> תיעוד, מדריכים ותרגומים
=====> תיעוד
=====> מדריכים
=====> תרגומים
===> קהילה
=====> הודעות
=====> הצג את עצמך
=====> אתרים לדוגמא
=====> כללי
=> Irish
=> Italian
===> Supporto
=====> FAQ
=====> Installazione
=====> Moduli, Plugin, Snippet e altro codice
=====> Web Design e Template
===> Documentazione, Tutorial e Traduzione
=====> Documentazione
=====> Tutorial
=====> Traduzione
===> Comunitŕ
=====> Annunci
=====> Presentazioni
=====> Siti in vetrina
=====> Chiacchiere in libertŕ
=> Japanese
===> サポート
=====> 良くある質問
=====> インストール
=====> モジュール・プラグイン・スニペット・本体
=====> デザインやテンプレート
===> マニュアル・テュートリアル・翻訳
=====> マニュアル
=====> 事例集、テュートリアル
=====> 日本語化
===> コミュニティ
=====> お知らせ
=====> MODxサイト展示場
=====> 自己紹介
=====> 雑談
=====> 国産リソース
=> Persian - فارسي
===> پشتيباني
=====> راهنما
=====> نصب
=====> ماژول , پلاگین ها , کد ها و جزییات
=====> طراحی و قالب ها
===> مستند سازی , آموزش ها و ترجمه ها
=====> مستند سازی
=====> آموزش ها
=====> ترجمه ها
===> انجمن ها
=====> اخبار
=====> معرفی کردن خود
=====> نمایش دادن سایت ها
=====> بحث های عمومی و سایر موضوعات
=> Polish
===> Wsparcie
=====> FAQ
=====> Instalacja
=====> Moduły, pluginy, snipety i kod
=====> Wygląd i szablony
===> Dokumentacja, tutoriale i tłumaczenie
=====> Dokumentacja
=====> Tutoriale
=====> Tłumaczenie
===> Społeczność
=====> Ogłoszenia
=====> Przedstaw się
=====> Twój serwis WWW
=====> Hyde Park
=> Portuguese
===> Suporte
=====> FAQ - Dúvidas Frequentes
=====> Instalaçăo
=====> Módulos, Plugins, Snippets e Código
=====> Design e Templates
===> Documentaçăo, Guias e Traduçőes
=====> Documentaçăo
=====> Guias
=====> Traduçőes
===> Comunidade
=====> Anúncios
=====> Apresente-se!
=====> Bar da esquina (fora de tópico)
=====> Portfólio de Sites
=> Russian
===> Поддержка
=====> ЧАВО (FAQ)
=====> Установка
=====> Модули, плагины, сниппеты и код
=====> Дизайны и шаблоны
===> Документация, Уроки, Перевод
=====> Документация
=====> Уроки
=====> Перевод
===> Сообщество
=====> Объявления
=====> Представьтесь публике
=====> Галерея сайтов
=====> Диван
=> Scandanavian
===> Support
=====> Frĺgor och svar
=====> Installation
=====> Moduler, plugins, snippets och kod
=====> Design & sidmallar
===> Dokumentation, guider och översättningar
=====> Dokumentation
=====> Guider
=====> Översättningar
===> Webbgemenskap
=====> Meddelanden
=====> Presentera dig själv
=====> Visa upp dina webbsidor
=====> Ordet fritt
=> Slovak
=> Spanish
===> Soporte
=====> FAQ
=====> Instalación
=====> Modulos, Plugins, Snippets & Código
=====> Diseńo y plantillas
===> Documentación, Tutoriales y Traducciones
=====> Documentatción
=====> Tutoriales
=====> Traducciones
===> Comunidad
=====> Anuncios
=====> Presentaciones personales
=====> Muestra de sitios
=====> El Café
=> Swedish
=> TÜRKÇE (Turkish)
===> Destek
=====> SSS
=====> Kurulum
=====> Modüller, Pluginler, Snippetlar & Kodlar
=====> Dizayn & Temalar
===> Belgeleme, Eğitmenler ve Çeviri
=====> Belgeleme
=====> Eğitmenler
=====> Çeviri
===> Topluluk
=====> Duyurular
=====> Kendinizi Tanıtın
=====> Site Vitrini
=====> Konu Dışı