Forums

No paragraph breaks in the textarea field

jennyjeffreys 05 Jun, 2012
I have recently migrated my website to Joomla 2.5 and recreated all the site forms with the latest version of Chronoforms.

However, it appears that the new version does not preserve paragraph breaks in text entered via the input_textarea field.

The form below:
<p>Event name: {input_text_2}</p>
<p>Category: {input_select_6}</p>
<p>Events details: {input_textarea_7}</p>
<p>Event date(s) and time(s): {input_textarea_14}</p>
<p>Location: {input_text_8}</p>
<p>Website: {input_text_9}</p>
		
<p>Upload photo/flyer: {input_file_12}</p>
<p>Upload photo/flyer: {input_file_13}</p>
<p>Your name: {input_text_18}</p>
<p>Your email: {input_text_19}</p>
<p>WHAT TO DO emails: {input_radio_15}</p>


Produces the following email:
Event name: Jenny Jeffreys

Category: Exhibitions

Events details: This is a test to see if the new form works with paragraphs. This is a test to see if the new form works with paragraphs2. This is a test to see if the new form works with paragraphs3. This is a test to see if the new form works with paragraphs4.

Event date(s) and time(s): And more paragraphs here. And more paragraphs here2. And more paragraphs here3.

Location: France

Website: http://www.knowitall.ch

Upload photo/flyer: image1.jpg

Upload photo/flyer: image2.jpg

Your name: ABC

Your email: abc@mail.com

WHAT TO DO emails: Please sign me up to receive WHAT TO DO emails.



As you can see the text entered as separate paragraphs for the Event details and Event date has no paragraphs, although it appears that the email is able to ready the <p> command as it has created para breaks between the different fields. This worked fine in the old version and is a real pain to work with in the new version as I have to then manually enter the para breaks for all the events submitted to our site. Am I missing something here, or is there a simple solution?

The form is located at: http://knowitall.ch/index.php/events-calendars/events-calendar/submit-event

Thanks for any help you can provide.
GreyHead 06 Jun, 2012
Hi jennyjeffreys,

It might be worth looking at the Email HTML using the Debugger and View Source to see exactly what HTML is being created. Usually ChronoForms preserves HTML fairly well but it may not preserve line-breaks correctly.

We've used the PHP nl2br function to solve similar problems so you might try adding a Custom Code action before the Email action with code like this:
<?php
$form->data['input_textarea_7'] = nl2br($form->data['input_textarea_7']);
$form->data['input_textarea_14'] = nl2br($form->data['input_textarea_14']);
?>

Bob
jennyjeffreys 12 Jun, 2012
Thank you!

That appears to have done the trick!
This topic is locked and no more replies can be posted.