textarea control

Hi all

does anybody know how to maintain line breaks etc, entered by user in textarea, in output.

I have entered an address with line breaks - the xml shows the content as a single line and a single line is output to the html.

regards
michelle

You need to add the wrap=“hard” attribute to the TEXTAREA element to preserve line breaks.

ah ok thanks

how do i do that?

thanks
Michelle

Hi

does anybody know how to set the wrap property of the textarea please. i am using 5.7.

thanks
michelle

[QUOTE=poferries;2434]Hi

does anybody know how to set the wrap property of the textarea please. i am using 5.7.

thanks
michelle[/QUOTE]

I am not sure about 5.7, I am using 6.5.2. In the workbench you would normally view the properties of the text area, click on the “…” next to the control type and then add properties that way. However! When I have just tried to do this in WB there is not wrap property…

I know how you would add this in, but how comfortable are you customising RX?

On another note, I thought it was wrap=“physical”, not hard?!

http://www.mountaindragon.com/html/physicalwrap.htm

Best Wishes

Georgina

Thanks Georgina

i guess i’m pretty comfortable with customising rx. would be grateful for any help you could provide as to where I need to add this property.

like you, I had gone to the workbench to try to do this and failed.

thanks again
regards
Michelle

ok, hold on to your hat :slight_smile:

BE WARNED, THIS CUSTOMISATION WILL BE OVERWRITTEN WITH ANY UPDATES, INCLUDING PATCHES, SO TAKE A COPY OF THIS FILE BEFORE APPLYING UPDATES/PATCHES SO YOU CAN CHANGE IT BACK

*** please take a backup of the file before you make any changes ***

  1. In WB, go to the System Design tab
  2. Open CMS Files, then sys_resources, then stylesheets
  3. Open the file called sys_Templates.xsl
  4. Search for this string:
<psxctl:Description>A simple text area</psxctl:Description>
<psxctl:ParamList>
  1. Add this code after the search string above:
<psxctl:Param name="wrap" datatype="String" paramtype="generic">
	<psxctl:Description>This parameter specifies whether the wrap attribute should be used</psxctl:Description>
	<psxctl:DefaultValue>physical</psxctl:DefaultValue>
</psxctl:Param>
  1. Save file!
  2. You will need to restart the server for this change to take effect. Don’t forget to close work bench as it caches the options.
  3. Open WB and edit the text areas you want to apply wrap.

This will now list wrap as an option under the properties for a text area control type. This works for me, although I have not tested what it outputs to the server. If it follows the normal browser textarea conventions then there should not be a problem.

Hope this helps.

Best Wishes

Georgina

Hi georgina

many thanks for your help. Have made the changes. However, the line breaks are still not being acted upon.

the xml still shows all the text in a single line as does the html page. The source of the page has however added white space and put the text on separate lines but this is not reflected in the display, ie there are no break or paragraph tags.

would be grateful for any more help. this seems such a simple thing and i just can’t seem to get it working.

thanks
michelle

Hi Michelle,

I am glad we have made a bit of progress with this!

Ok, this might be related to the XML itself. By default, XML does not retain white space.

When you say “xml still shows all the text in a single line as does the html page” What are you actually refering to? Can you give me an example?

Thanks

Georgina

Hi Georgina

thanks again for all your help.

When the data gets stored in the database, it stores the line breaks as a square so i guess it is storing them as some kind of symbol. however when pulled back from the database to an xml file, they show as spaces. Tech support suggest i need some kind of exit or processing in my template to convert them to line breaks. However, as they show as spaces in the XML, I can’t really use a function to replace them as the data itself entered by the user has spaces so i don’t know how to distinguish between them.

I had assumed that by making the control use hard breaks, when the data was retrieved from the database it would maintain these.

I need to find some way to display in the web pages, the line breaks that the user has entered.

hope this makes sense.

thanks
michelle

I misunderstood your initial question and got us all started chasing a red herring, sorry about that :slight_smile: Ignore all this stuff about the textarea control.
[Side note: Georgina, regarding your question about the wrap attribute value. This attribute is not defined by the HTML std, so it was even more subject to browser implementation variations. It appears that many years ago, ‘physical’ only worked on IE, but ‘hard’ worked on all browsers, therefore I took what seemed to be more cross-browser compliant. This may not be an issue today.]

I assume you are using 5.x since you mentioned xml output. You should not lose CRLF in the XML output, but you have to be careful how you are viewing it. If you view the xml in a browser, it may appear that you have lost the line breaks, but they are still there. Open the source in a text editor to verify.

The reason you are ‘losing’ the line breaks is due to how HTML is rendered. All adjacent whitespace is normalized in HTML to a single space. If you want line breaks, you need to insert <p> or <br> whereever you want the whitespace.

Therefore, you need to replace (or add to) all line break occurrences in your field’s content with either one of the aforementioned elements. This will generate the desired output.

It doesn’t appear there is a way to do this out of the box. You will need to write a small Java exit that does it (there might be a way to do it using XSL, but my XSL is very weak.) This would be a UDF. It would be very simple for someone who knows Java.

ok thank you for this

have passed this over to our java developers to write me a UDF.

however, little confused why the control wouldn’t provide this functionality in the first place.

One more question if anybody is able to help. I need to allow the users to enter links into the text area. Currently while testing and developing this I have entered the anchor tag as text but obviously this gets written to the html page as text. I may be approaching my problem in completely the wrong way but below is the reason I am using the textarea.

I am trying to allow the users to create tables with a variable number of columns. So I have an application called PO_Table_ce which has a child editor, containing 10 textareas - so the users can create a table up to 10 columns wide and as many rows as they need.

Ideally, I would want to use the EditLive control for this to allow users to format text, enter links etc etc. However, as they can potentially have 10 x numRows EditLive controls on a single page, the browser can’t handle this.

Has anybody else implemented a table type editor - or does anyone have suggestions/comments about my approach to this solution.

would be grateful for any help

thanks
michelle

Hi Michelle,

Am I being dumb, but why don’t you just use a EditLive control at the top level and have a table within that?

Then the users can have links, formatting, etc. and it retains line breaks, but also allows users to control how many rows/columns they have in the table.

Best Wishes

Georgina

Hi Georgina

no you are not being dumb and this is exactly how we have implemented it on our first site. However, our users have NO HTML experience and we have found that allowing them to add their own tables etc in this way often breaks the validity of our code, our accessibility standards and our design.

In building this 2nd site we wanted to take as much pressure away from the users as possible and allow them to simply type in text rather than having to add tables etc. I am probably being too protective of them and of our site content but due to problems experienced in the past, this does seem to be a better solution for our user - and will hopefully mean that IT is not called upon to fix “user errors”.

Having said that, I obviously haven’t found the best solution yet as too many editlives crashes browser, textarea does not provide required functionality etc etc.

Would be grateful for any advice or tips if anyone has had similar issues.

thanks
michelle

Hi Michelle,

What about trying to do this with an inline template in EditLive?

Best Wishes

Georgina

Hi Georgina

don’t know exactly what you mean - is there some documentation somewhere that you know of.

thanks
michelle

Hello there

We have a similar issue with non-valid table mark-up, so we customised our standard Ephox configuration (nhmStandard) to remove all the table menus and commands. Instead we created a Table CT that has the table controls in another customised Ephox configuration (nhmTable) and use the HTML Tidy function to remove any dodgy mark-up. Users then add tables to their pages as inline template snippets.
In addition, we created another customised version of Epox - nhmItalics - which is the control for fields that would normally use an EditBox but where scientific names are used e.g. displaytitle, linktitle etc.

It’s not that difficult to customise Ephox (there’s a big PDF ‘Developer’s Guide’ in rx-resources/ephox) and we have removed a number of buttons and menu items e.g. horizontal rule, text colour, font family etc. that we do not want users to use.

Thanks for this Cara

but what is an inline template - this is not something I have heard of before and I don’t recall it being mentioned in the developer training.

thanks
michelle

Sorry Michelle, it is the 6.52 name for an inline variant - for some reason Rx now calls everything a template, including variants, so it gets a bit confusing at times, especially when you’ve been used to the term variants for several years! Personally I wish they would change it back…:confused:

Cara

thanks cara

but i’m still no clearer - inline variant? is this specific to ephox - i dont’ recall this on the developer course.

either that or rx has frazzled my brain so much that i have forgotten what i do know!!!

thanks
michelle