Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Populating multiple lines with HTML formated text via calculated script

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

0 votes

Comments

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

1 vote

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?

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

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

0 votes

Comments

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.

Thanks Ralph


3 other answers

Permanent link

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

0 votes


Permanent link

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

0 votes

Comments

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

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

0 votes

Comments

Hi - This Didn't work.

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.

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 16

Question asked: Oct 18 '17, 11:09 a.m.

Question was seen: 2,362 times

Last updated: Nov 01 '17, 10:09 a.m.

Confirmation Cancel Confirm