Help to capture and show a field response using smarty

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
Trenia
Forum Members
Forum Members
Posts: 81
Joined: Thu Dec 11, 2008 12:48 pm

Help to capture and show a field response using smarty

Post by Trenia »

Hi

I hope this is the right place to ask for this. In Form Builder, how can I capture someone`s selection (radio buttons) and have this show in the email subject line in my inbox? I have very little knowledge about smarty-tags, so I would very much appreciate it if someone could point me in the right direction.

Please ask if you need more information.

Ps! I am using Form Builder version 0.7.4 and Cmsms version 1.11.11

Tom
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Help to capture and show a field response using smarty

Post by Jo Morg »

Before anything else: please downgrade to FormBuilder 0.7.3. Version 0.7.4 wasn't stable and was removed from the Forge. If you have already too much work invested in custom forms, export them to XML, uninstall FB, remove the folder and install 0.7.3 from scratch. Then import the xml files.

As for your question, please read the help page of FormBuilder, and consult the list of available fields in the Advanced Settings of Email Results to set Address(es) disposition. These Smarty variables are available (iirc) in the Email Subject Line field of the Email Results to set Address(es) disposition, you just have to copy the one you want and paste it back in the Email Subject Line field.

HTH
"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!
User avatar
Trenia
Forum Members
Forum Members
Posts: 81
Joined: Thu Dec 11, 2008 12:48 pm

Re: Help to capture and show a field response using smarty

Post by Trenia »

Thank you. I did what you said about downgrading the Form builder version. Everything seemed to go well, but when testing the form I now get this error:

Warning: Illegal offset string 'sent' in
/xxxx/xxx/xxxx/xxxx/FormBuilder/classes/DispositionEmailBase.class.php on line 82

This goes for both my forms. Email is sent but the input from fields are displayed in the wrong places. I get phone number where the adress should be and so on...

Suggestions?
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Help to capture and show a field response using smarty

Post by Jo Morg »

Trenia wrote:Warning: Illegal offset string 'sent' in
/xxxx/xxx/xxxx/xxxx/FormBuilder/classes/DispositionEmailBase.class.php on line 82
mmm, other than that warning, does it work?
If it doesn't fail (it shouldn't), I wouldn't be too concerned with that (mind you that on a production site, the errors should be logged not displayed): this is fixed in svn already and just waiting for next release (in final tests stage).
"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!
User avatar
Trenia
Forum Members
Forum Members
Posts: 81
Joined: Thu Dec 11, 2008 12:48 pm

Re: Help to capture and show a field response using smarty

Post by Trenia »

Jo Morg wrote:mmm, other than that warning, does it work?
If it doesn't fail (it shouldn't), I wouldn't be too concerned with that (mind you that on a production site, the errors should be logged not displayed): this is fixed in svn already and just waiting for next release (in final tests stage).
Thank you. Yes the result is shown and the email is sent. but the error is visible on top of the page.

What about the the other errors? Field results showing up in wrong places? Is this also because of the same thing?
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Help to capture and show a field response using smarty

Post by Jo Morg »

Trenia wrote:Thank you. Yes the result is shown and the email is sent. but the error is visible on top of the page.

What about the the other errors? Field results showing up in wrong places? Is this also because of the same thing?
The errors are displayed regardless of your page templates layout, so errors usually deface the pages where they appear in.

http://php.net/manual/en/function.error-reporting.php
"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!
User avatar
Trenia
Forum Members
Forum Members
Posts: 81
Joined: Thu Dec 11, 2008 12:48 pm

Re: Help to capture and show a field response using smarty

Post by Trenia »

Well, in the last 3-4 years I`v never had this error appearing, no matter what version I have used, isn`t that a little strange? Sure it hasn`t something to do with reinstalling? By the way, I noticed that the {$fld_xx} numbers are changed now, after downgrading. I guess that is why the field responses came out wrong. Seems to be okey now, but still the string error though.

Anyway, thank you very much for helping. :)
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Help to capture and show a field response using smarty

Post by Jo Morg »

Trenia wrote:Well, in the last 3-4 years I`v never had this error appearing, no matter what version I have used, isn`t that a little strange?
To be able to answer that I'd need a lot more info that what I have available atm. :)
Trenia wrote:Seems to be okey now, but still the string error though.
Yep, developers usually do (and should) keep the error level set to show all errors on developing environments. That is the best way to avoid errors, bugs, etc.
However there are some circumstances that may trigger the display errors on scripts that used to run without errors before, one of these being differences in how PHP is implemented between versions, even differences in what is considered an error (or a warning, or even a notice for that matter)... these are not controlled by the script developer.
That's why it is recommended to suppress the display of PHP errors (all of them) in production servers, logging them to a file. There a few ways to do this, just google for php error levels, or check the link on my previous post.
Trenia wrote:Anyway, thank you very much for helping. :)
No problem.
"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!
User avatar
Trenia
Forum Members
Forum Members
Posts: 81
Joined: Thu Dec 11, 2008 12:48 pm

Re: Help to capture and show a field response using smarty

Post by Trenia »

I managed to get rid of the error displaying when hitting submit in the forms.

I tried several solutions. Adding code to .htaccess did not work. Adding code to php.ini did not work, but finally after adding this to my index.php it finally worked. Don`t know if it is optimal though.. :)

Code: Select all

<?php
ini_set('display_errors','off');
?>
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Help to capture and show a field response using smarty

Post by Jo Morg »

It's fine, at least until next version of FormBuilder is released.
"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!
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Help to capture and show a field response using smarty

Post by velden »

Trenia wrote:... but finally after adding this to my index.php it finally worked. Don`t know if it is optimal though.. :)

Code: Select all

<?php
ini_set('display_errors','off');
?>
I'd recommend using config.php for that. config.php would not be overwritten during future upgrades of CMSMS.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: Help to capture and show a field response using smarty

Post by Jo Morg »

@velden good call! :)
"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!
User avatar
Trenia
Forum Members
Forum Members
Posts: 81
Joined: Thu Dec 11, 2008 12:48 pm

Re: Help to capture and show a field response using smarty

Post by Trenia »

velden wrote:I'd recommend using config.php for that. config.php would not be overwritten during future upgrades of CMSMS.
Thank you velden. Done! :)
Post Reply

Return to “Modules/Add-Ons”