How to add a html code into the HTML type Text box?

xavifrancis
Kilo Expert

Hi All,

I am trying to insert a source code into the HTML type field through a business rule and I want the output of the code in that field.

How can we directly add the source code into the field through business rule?

find_real_file.png

Please suggest on this.

3 REPLIES 3

hugogomes
Giga Expert

Hi,

 

you can do it as it was a string, by dividing it into smaller pieces of HTML script.

for example:

var html_header = "<html>";

var body_start = "<body><h2 title='TEST'>The title Attribute</h2>";

var par = "<p>TEST</p>";

var body_end = "</body>";

var html_end = "</html>";



current.description = html_header + body_start + par + body_end + html_end;

Hope it helps!

 

We have already following the method which you have suggested.

But, while exporting the record in PDF format, it is not in the format which is actually there.

Please refer the Screenshot:

In the form it looks like,

find_real_file.png

 While exporting, it is giving this value.

find_real_file.png

 

But, if I saved the form once and exporting, it is giving the exact value,

find_real_file.png

Kindly suggest, what should be followed to get the result.

I've struggled with that quite a lot, but I've manage to fix it.

You need to add the equivalent of "\n" but in HTML format, meaning, you need to add "<br>" and "</br>" for every paragraph you add.

In your case:

var example = "<br>Termination: Cause</br><br>Applied Materials can only terminate with specific cause</br><br>Contract Notes: test</br>";

And so on.

 

Hope it helps!