Page 1 of 1
Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 11:49 am
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
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 12:20 pm
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
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 1:58 pm
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?
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 2:18 pm
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).
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 2:33 pm
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?
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 2:46 pm
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
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 3:28 pm
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.

Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 3:46 pm
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.
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 5:54 pm
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');
?>
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 5:56 pm
by Jo Morg
It's fine, at least until next version of FormBuilder is released.
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 7:01 pm
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.
Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 7:47 pm
by Jo Morg
@velden good call!

Re: Help to capture and show a field response using smarty
Posted: Thu Oct 02, 2014 7:50 pm
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!
