Page 1 of 1

Highlight a specific line in a text area

Posted: Fri Apr 06, 2018 5:01 am
by chs
Hi everyone,

I have a text area (widget type = text area) with several lines (font = courier new).

Is it possible to highlight a specific line within the text area ?

For example:
Text for line 1.
Text for line 2.
Text for line 3.
Text for line 4.

I tried to add <b> ..text.. </b> but it isn't working.

There is a hex code x'25' for return resp. line feed which works fine. Is there also a hex code to highlight a line or a few words within the text area ?

Is there another function or is the only way to achieve this goal to use a html container or to use java script code ?

Having a function to easily highlight a few lines or words within a text area would be very helpful.

Thank you for your help in advance.

Christoph

Re: Highlight a specific line in a text area

Posted: Fri Apr 06, 2018 12:20 pm
by mcorbo
Instead of a text area, use an html container with the html property rather than the value property set.
html.JPG
html.JPG (27.64 KiB) Viewed 547 times

Re: Highlight a specific line in a text area

Posted: Mon Apr 09, 2018 5:21 am
by chs
Thank you for your input.

Using a simple grid with a textbox in each row instead of a text area is also working (see attached file).

Re: Highlight a specific line in a text area

Posted: Wed Apr 11, 2018 1:47 pm
by Scott Klement
A text area is simply a widget that inserts the HTML <textarea> tag. This does not offer for any sort of special formatting.... and is a built-in capability of the browser that we cannot change.

The solutions that chs and DanD have offered are both output-only solutions, which seems strange considering that a text area is an input field. But, perhaps the input capability isn't needed?

If you do want to provide formatting like this in an input field,I'd suggest incorporating a 3rd party JavaScript library for a rich text editing box. We have an example of one popular choice known as TinyMCE in our documentation here: http://www.profoundlogic.com/docs/displ ... MCE+Editor

Re: Highlight a specific line in a text area

Posted: Thu Apr 12, 2018 5:37 am
by chs
Thank you for your answer.

I will have a look at the MCE Editor.

The textbox field in my grid is an input field. I have created a little editor with a simple grid, a textbox and a bit of Java Script code. See attached file.