It's all about the answers!

Ask a question

Populating multiple lines with HTML formated text via calculated script


Dulsanka Kulasinghe (3812) | asked Oct 18 '17, 11:09 a.m.

Hi

I'm with a need of pushing multiple lines, HTML formated text to a Medium HTML field via a calculated script. I tried to use dom constuctor but it didn't work for me well.

Eg: Upon selection of an item from one Enume, I want to dispaly some sample text in a readonly "Medium HTML" field.

Sample text: [

This is my Tesample text:

1. My first line

2. My Second Line

]

Appreciate your help.

DK


Comments
1
Donald Nong commented Oct 18 '17, 8:39 p.m.

What didn't work? Did the text not appear in the field? Or it appeared but in a wrong format?


Dulsanka Kulasinghe commented Oct 20 '17, 4:26 a.m.

If you ask about dom constuctor, it never recognised; so no output.

Is it possible to direct me to an examle or share with me an examle code for this?


Ralph Schoon commented Oct 20 '17, 5:34 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Dulsanka Kulasinghe commented Oct 20 '17, 8:17 a.m.

Thanks Ralph for sharing, however, yet I'm in doubt what to refer?

Will I get a way to return a multiple lined HTML text (as in the example) to a mediumHTML in the article you shared? Based on my reading I'm bit confused with the answer.

Accepted answer


permanent link
Dulsanka Kulasinghe (3812) | answered Nov 01 '17, 7:32 a.m.

Hi, My progress so far is as follows and I think I found my solution:

Sharing this for any intersted parties awareness-

Sampe code I used:

var Request = "* Line 1 \\\\\ **line 2** \\\\\ [[The URL2|link name1]] \\\\\ --Line 3-- \\\\\ __New line 4__ \\\\\ [[The URL2|link name2]]";

The output I render to two riffrent fields. One with Wiki and ther other is HTML.

HTML output:

wiki Output

So, this can is possible with a wiki field. But still I'm unable to generate a list or a numbered field. If anyone can guide, appreciate your help.

DK

Ralph Schoon selected this answer as the correct answer

Comments
Ralph Schoon commented Nov 01 '17, 7:57 a.m. | edited Nov 01 '17, 8:06 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

Note that this answer/post above contains an image that is suppressed because of the missing reputation.

The symptoms you see is:

  1. If you try to set a HTML attribute, the tags get converted and you basically see the HTML tags in the text and they don't have an effect
  2. It is possible to use a WIKI type attribute then you can use the Wiki syntax and can create bold italic, links etc.

1. I have explained this several times already - and answered in this thread as well in https://jazz.net/forum/questions/245867/populating-multiple-lines-with-html-formated-text-via-calculated-script/245960 . It seems that Java uses the class XMLText.createFromPlainText() to encode the JavaScript value for HTML strings and the description, which has the effect described.

2. Wiki attributes don't do this. See http://www.wikicreole.org/ for the Wiki syntax.


Dulsanka Kulasinghe commented Nov 01 '17, 10:03 a.m.

Thanks Ralph

3 other answers



permanent link
Ralph Schoon (63.3k33646) | answered Oct 20 '17, 8:27 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 23 '17, 4:13 a.m.

Since you only provide the absolute minimum of information and were not even able or willing to answer Don's question (See How should I ask a question in the Forum if I want to receive useful answers? if you want to improve yourself), here my suggestion:

Read https://jazz.net/library/article/1093 the Lab 5 and check the examples.

Note, for all I know

  • You can add multi line text with attribute customization/calculated values
  • I am not aware of a way to add HTML format - the tags are converted to text


permanent link
Dulsanka Kulasinghe (3812) | answered Oct 20 '17, 10:07 a.m.

Hi Ralph

First, I did ask the question with maximum possible way I can ask same and even with an example. Really sorry for you not being able to understand what I want.

Second, again really sorry as "What didn't work? Did the text not appear in the field?" for me, this is more an unclear question. I assumed that he is asking about using "Dom", so I mentioned the actual error I got, The "Dom Constructor" was not recognised at the execution.

Assuming it is not clear, let me try to repharese the question.

I use a customised attribute linked to an enumeration (Let’s say its "Country") What I want is, to display some bullet point statement about the selected country in another custom attribute field (let’s say "Country Description").

Eg: when I select "USA" in the country field, I want to display like below in the "Country Description" fielf.

1. USA has XX states

2. Its boarded to XXX, XXXXX, XXX countries.

3. The capital of USA is XXXXXXXX

I would like to know, can this be done via a Calculated script or is there any easy way of doing this?

Thanks

DK


Comments
Ralph Schoon commented Oct 23 '17, 4:16 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

See my answer: above: https://jazz.net/forum/questions/245867/populating-multiple-lines-with-html-formated-text-via-calculated-script/245960  I made the relevant part more obvious.

You can show multi line text e.g. example working with description.

To my knowledge HTML tags can't be used in attribute customization. The tags will be converted to text. 


permanent link
Kevin Ramer (4.5k9186201) | answered Oct 20 '17, 12:20 p.m.

I've found that using the br  tag for each line works in HTML fields.

e.g. 

1.   line 1<br/><br/>2. line 2<br/><br/>

And so on


Comments
Dulsanka Kulasinghe commented Nov 01 '17, 4:29 a.m.

Hi - This Didn't work.


Ralph Schoon commented Nov 01 '17, 7:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

What did you see?

Hi - This Didn't work. This does provide 0 value. It is like car does not work. My car is burning or my cars motor does not start, but I hear the starter provides more value.


Dulsanka Kulasinghe commented Nov 01 '17, 10:05 a.m. | edited Nov 01 '17, 10:09 a.m.

The browser didn't recognise any of above tags. Hence, the output was as same as the code text.
Eg: if the code was “1.   line 1<br/><br/>2. line 2<br/><br/>”, the output was same.
Trust this clarifies.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.