Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

losing carriage returns in text field

Featured Replies

  • Newbies
I am wanting to show contact info for a family.  The output I get is putting everything on one line.  It is ignoring the carriage returns.  My field in my database is a calculated field with carriage returns after certain info. See below for how I want the output to look.
 
I am displaying the data in a table.  This is the line where I call the getField function.
 
$table3_data .=  $related_record->getField('HOH Info::DirectoryCombinedText');
 
 
 
Output looks like:
Parent1 Name & Parent2 Name Children: Child1, Child2, etc Address City, State Zip (h) (111)111-1111 Parent1 Name (111)111-1111 Parent2 (111)111-1111 Parent2 Name - [email protected] Parent2 Name - [email protected]
 
What I want output to look like:

Parent1 Name & Parent 2 Name

Children: Child1 Name, Child2 Name,etc

Address

City, State, Zip

(h) (111) 111-1111

Parent1 Name (111) 111-1111

Parent2 Name (111) 111-1111

Parent1 Name - [email protected]

Parent2 Name - [email protected]

  • Author
  • Newbies

Figured it out.  I used nl2br() and it works great.

 

$table3_data .=  nl2br($related_record->getField('HOH Info::DirectoryCombinedText'));

Could you provide a sample so I can try to understand you a bit better?

It's a standard php function to turn carriage returns and new lines into something that web browsers understand...

 

nl2br($field) will take

 

data

data

 

and make it

 

data<br>data

 

Which will then be shown in a browser as

 

data

data

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.