Page 1 of 1
how can I preserve line breaks in formbuilder submission
Posted: Thu Jun 04, 2009 11:24 pm
by geeves
Hey guys.
Just wanted to know if there is any way of preserving line / paragraph breaks entered in a text field in a FormBuilder form?
My client is complaining that the submission html template is too hard to read without the line breaks.
Cheers
Re: how can I preserve line breaks in formbuilder submission
Posted: Wed Jun 10, 2009 4:50 am
by Ast
bump, I would really like to know as well. I have tried playing around with the files but I don't have much experience with php.
Re: how can I preserve line breaks in formbuilder submission
Posted: Wed Jun 17, 2009 10:29 pm
by kittymcooper
I had the same problem and the only solution I found was to use HTML template and replace the returns with br via a Smart command. This looks nicer anyway. This is the line I use in the message template for the message text which preserves line breaks:
Code: Select all
<strong>Message</strong>: {$message|regex_replace:"/[\n]/":"<br />"}<br />
to add an an extra blank line do both the CRand the LF
Code: Select all
<strong>Message</strong>: {$message|regex_replace:"/[\n\r]/":"<br />"}<br />
You also need to add the same line in the submission template to show the user his message with the line breaks.
[solved] Re: how can I preserve line breaks in formbuilder submission
Posted: Wed Jun 17, 2009 10:31 pm
by kittymcooper
forgot the solved in the top line and meant to say a Smarty command - regex
Re: how can I preserve line breaks in formbuilder submission
Posted: Thu May 17, 2012 10:08 pm
by govicinity
Really old thread, but I thought I'd post the answer anyway, go to your form in the FormBuilder module, go down to the form fields section in the Main tab. Click on the edit Send to button. Once in there click on Advanced settings, then in the Email Template area paste your submission template code, this is mine:
Code: Select all
Your Website Name Form Submission
Form Name: {$sub_form_name}
Date of Submission: {$sub_date}
Your server: {$sub_host}
IP address of person using form: {$sub_source_ip}
URL of page containing form: {$sub_url}
FormBuilder version: {$fb_version}
-------------------------------------------------
Name: {$your_name}
Email address: {$email_address}
Email address again: {$email_address_again}
Telephone Number: {$telephone_number}
Subject: {$subject}
Message: {$message}
And bob's your uncle, line breaks and a nicely laid out plain text email submission.
Re: how can I preserve line breaks in formbuilder submission
Posted: Thu May 17, 2012 10:22 pm
by Dr.CSS
Sorry govicinity but that wasn't what they were looking for, when you fill out a text area field in forms like Message: {$message} it won't see line breaks, it just makes the text one long sentence so what they need is more along these lines...
Message: {$message
|nl2br}
http://www.smarty.net/docsv2/en/languag ... .nl2br.tpl