Pass an email recipient variable in formbuilder tag

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Mich-adg
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 02, 2008 9:08 pm

Pass an email recipient variable in formbuilder tag

Post by Mich-adg »

Hi,
i'm looking for a tip to pass an email address in the formbuilder tag.
I have one form, and it must show on multiple page, but must have another recipient according to the viewed page (so i can add a variable in the smarty field of each page, but how to pass this variable to Formbuilder tag ?).
Thanks for any idea... !
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Pass an email recipient variable in formbuilder tag

Post by Jos »

I think you can use the fieldtype *Email Results Based on Pulldown
You could hide the field with css and set the value with javascript according to the page.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Pass an email recipient variable in formbuilder tag

Post by Jo Morg »

Or, and assuming you did set an alias to the field suggested by Jos, you can replace the field with

Code: Select all

<input type="hidden" name="{$actionid}{$<fieldalias>->input_id}" value=""/>
where <fieldalias> should be replaced by the alias of the field. I tend to replace all the field auto handling of the default FB template by my own HTML fields as long as I keep the name="{$actionid}{$<fieldalias>->input_id}" rule for every single field I have defined previously on FB. Also need to keep in mind that some fields handling arrays of values will surely need [] appended to the name attribute. This means that you can handle virtually any type of form with FB, be it simple or complex.
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Mich-adg
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 02, 2008 9:08 pm

Re: Pass an email recipient variable in formbuilder tag

Post by Mich-adg »

Thanks for the tips !!
Jo : how do you replace the field? In the form template?
If i use the javascript method, will the email address be "visible" for spam bots?
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: Pass an email recipient variable in formbuilder tag

Post by Jos »

Mich-adg wrote: If i use the javascript method, will the email address be "visible" for spam bots?
No because you define item/value pairs in the fielddefinition, and of course the item should be something else than the emailadres.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Pass an email recipient variable in formbuilder tag

Post by Jo Morg »

Mich-adg wrote:Jo : how do you replace the field? In the form template?
Yes. As I said:
Jo Morg wrote:I tend to replace all the field auto handling of the default FB template by my own HTML fields
But for that you'll either trap the correct field on the foreach loop or replace all the fields which is what I do. However to be able to call the fields by alias you'll have to set them on all fields.
Mich-adg wrote:If i use the javascript method, will the email address be "visible" for spam bots?
As Jos just replied, and is also valid with the hidden field approach...
Mich-adg wrote:I have one form, and it must show on multiple page, but must have another recipient according to the viewed page (so i can add a variable in the smarty field of each page, but how to pass this variable to Formbuilder tag ?).
In this case you don't need javascript...

Code: Select all

<input type="hidden" name="{$actionid}{$<fieldalias>->input_id}" value="{$MySmartyVar}"/>
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Mich-adg
Forum Members
Forum Members
Posts: 200
Joined: Sat Aug 02, 2008 9:08 pm

Re: Pass an email recipient variable in formbuilder tag

Post by Mich-adg »

Thanks so much !
Post Reply

Return to “Modules/Add-Ons”