Line breaks in display-only text areas

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Simon
Ebase User
Posts: 25
Joined: Thu Aug 27, 2009 9:43 am
Location: Hampshire County Council
Contact:

Line breaks in display-only text areas

#1

Postby Simon » Thu Jan 21, 2010 8:50 am

Hi all

Hopefully a nice easy one ;)

I have a display-only table that contains text area columns. When a text area entry contains a line break, it is not rendered and is displayed as a single space. The entry appears correctly (i.e. with line breaks rendered) when the column is not set to display only.

Is there any way around this? PDF prints also do not render line breaks for text area columns in tables.

Thanks for your help

Simon
0 x

Simon
Ebase User
Posts: 25
Joined: Thu Aug 27, 2009 9:43 am
Location: Hampshire County Council
Contact:

#2

Postby Simon » Thu Jan 21, 2010 10:46 am

Apologies, the text areas are rendering correctly when the table column is set to Display Only... unless the column is set as a hyperlink. Is there any way around this (other than using a different column for my hyperlinks)?

The PDF problem, however, still stands :(

Cheers
Simon
0 x

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#3

Postby Vircos » Fri Jan 22, 2010 7:30 am

Simon,

Set the table column to Display Only and check HTML at the presentation tab under the column properties. Replace \n\r (ASCII notation) with <br> (HTML notation) That should do the trick.

A second option would be using the <pre></pre> tags. Apply the first the line of the first option and put the content of the field between <pre></pre>. The result would be that flat text (ASCII) will be rendered by the browser as it would be rendered by a normal text-editor. I am not sure if this option works, but you could give it try.

For your PDF you should use \n\r instead of <br> for a line break.

Let me know if it works.

Regards,
Vircos
0 x
What's the meaning of Justice...

Simon
Ebase User
Posts: 25
Joined: Thu Aug 27, 2009 9:43 am
Location: Hampshire County Council
Contact:

#4

Postby Simon » Fri Jan 22, 2010 8:36 am

Hi Vircos, thanks for your reply
Vircos wrote:
A second option would be using the <pre></pre> tags. Apply the first the line of the first option and put the content of the field between <pre></pre>. The result would be that flat text (ASCII) will be rendered by the browser as it would be rendered by a normal text-editor. I am not sure if this option works, but you could give it try.
Interestingly enough, this works very well! It even presents the text correctly on the PDF... almost. For some reason, the table rows don't quite expand far enough, and cut off half of the bottom line of text. The font defaults to Courier, but I'll try changing it, and add some padding, in the CSS and see what happens.

Thanks for your help!
Simon

:EDIT:
I've just realised that this solution will only work for one particular table. I have another table where the user can update table entries directly on the screen. Clicking a "save" button will update the table. Because these fields must be editable, I cannot inject HTML into them. By their nature, these fields appear correctly on the screen, but on the PDF the line breaks are not rendered. I have tried manually typing the ASCII \n\r notation, but the PDF literally prints "\n\r" instead of rendering it as a line break.

I find it strange that text areas are happily rendered correctly on the PDF, but text area columns in tables are not. Is this a bug in Ebase?

:EDIT PART II:
I've just noticed that Ebase does in fact render the carriage returns entered into a text area column on a table... However, it puts all the carriage returns at the END of the text, rather than in the correct position. For example if I entered the following text into a text area field on a table:

Code: Select all

Hello
New line
My old friend
It appears as follows in the PDF:

Code: Select all

Hello New line My old friend


Again this only happens on text areas presented in tables. Text area fields that are added to a form as normal appear correctly on the PDF.
0 x

Vircos
Ebase User
Posts: 97
Joined: Thu Sep 13, 2007 6:07 am
Location: The Netherlands

#5

Postby Vircos » Mon Jan 25, 2010 8:28 am

Simon wrote: I find it strange that text areas are happily rendered correctly on the PDF, but text area columns in tables are not. Is this a bug in Ebase?

:EDIT PART II:
I've just noticed that Ebase does in fact render the carriage returns entered into a text area column on a table... However, it puts all the carriage returns at the END of the text, rather than in the correct position. For example if I entered the following text into a text area field on a table:

Code: Select all

Hello
New line
My old friend
It appears as follows in the PDF:

Code: Select all

Hello New line My old friend


Again this only happens on text areas presented in tables. Text area fields that are added to a form as normal appear correctly on the PDF.
I do not have any experience with the built-in PDF-editor of Ebase. In stead of the built-in editor we use Adobe Designer in combination with Adobe Acrobat Professional and using \n\r always works with PDF's we have created. I have no idea what this could be.
Last edited by Vircos on Mon Jan 25, 2010 9:05 am, edited 1 time in total.
0 x
What's the meaning of Justice...

Simon
Ebase User
Posts: 25
Joined: Thu Aug 27, 2009 9:43 am
Location: Hampshire County Council
Contact:

#6

Postby Simon » Mon Jan 25, 2010 9:02 am

Ah right, cheers Vircos, I don't think I have access to that software.

Do any Ebase folks know what may be causing this? If not I'll raise it as an error.

Cheers
Simon
0 x


Who is online

Users browsing this forum: No registered users and 139 guests