how can I preserve line breaks in formbuilder submission

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
geeves
Forum Members
Forum Members
Posts: 114
Joined: Wed Dec 03, 2008 4:56 am

how can I preserve line breaks in formbuilder submission

Post 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
Last edited by geeves on Fri Jun 05, 2009 6:18 am, edited 1 time in total.
Ara Garabedian
Multimedia Designer / Developer
http://ara.ifky.com.au
Ast
New Member
New Member
Posts: 2
Joined: Wed Jun 10, 2009 4:29 am

Re: how can I preserve line breaks in formbuilder submission

Post 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.
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am

Re: how can I preserve line breaks in formbuilder submission

Post 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.
Kitty Munson Cooper, web designer, programmer
User avatar
kittymcooper
Forum Members
Forum Members
Posts: 44
Joined: Sat Aug 02, 2008 4:40 am

[solved] Re: how can I preserve line breaks in formbuilder submission

Post by kittymcooper »

forgot the solved in the top line and meant to say a Smarty command - regex
Kitty Munson Cooper, web designer, programmer
govicinity
Forum Members
Forum Members
Posts: 125
Joined: Tue Nov 22, 2011 2:22 pm

Re: how can I preserve line breaks in formbuilder submission

Post 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.
Going up, woop, woop.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: how can I preserve line breaks in formbuilder submission

Post 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
Locked

Return to “Modules/Add-Ons”