Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Change parts of text field to bold via JavaScript

sukram87
Level 1
Level 1

Hi everyone

 

In Adobe Live Cycle Designer ES4, I have a text field named "TEXT" (option "Allow Multiple Lines" activated). It is binded to a string field of an ABAP structure.

I want to change certain parts of the text field to bold. They are already marked with "\b" for the starting point and "\b0" for the ending point.

How is that possible? I am not good with Javascript :(

TEXT.font.weight = "bold" works for me, the complete field changes to bold. But how can I change certain parts of the text field?

 

Thanks a lot in advance for any help!

1 Accepted Solution
Kosta_Prokopiu1
Correct answer by
Employee
Employee

Hi,

 

not so easy because you need to write the whole XHTML shebang into the exData section.

Make sure your TextField is of type Richtext!

Initialize event of the field:

 

var envelope = "<?xml version='1.0' encoding='UTF-8'?>" +

"<exData contentType='text/html' xmlns='http://www.xfa.org/schema/xfa-template/2.8/'" +

"><body xmlns='http://www.w3.org/1999/xhtml' xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/' " +

"xfa:APIVersion='Acroform:2.7.0.0' xfa:spec='2.1'>" +

"<p> test <b>BOLD</b> test</p></body></exData>";

this.value.exData.loadXML(envelope,1,1)

 

result:

Kosta_Prokopiu1_0-1623053909651.png

 

View solution in original post

6 Replies
PulkitJain
Employee
Employee

@sukram87 

Here are some useful tricks if the text field is having Rich text data.

You can refer to the sample form shared with the blog for more insight on the implementation.

 

Hope this helps!

sukram87
Level 1
Level 1

Hi PulkitJain

Thank you!

Unfortunately, it does not work. I know this article and tried it previously but without success:

sukram87_0-1622796739216.png

The field format is "Rich Text". What is wrong?

Kosta_Prokopiu1
Correct answer by
Employee
Employee

Hi,

 

not so easy because you need to write the whole XHTML shebang into the exData section.

Make sure your TextField is of type Richtext!

Initialize event of the field:

 

var envelope = "<?xml version='1.0' encoding='UTF-8'?>" +

"<exData contentType='text/html' xmlns='http://www.xfa.org/schema/xfa-template/2.8/'" +

"><body xmlns='http://www.w3.org/1999/xhtml' xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/' " +

"xfa:APIVersion='Acroform:2.7.0.0' xfa:spec='2.1'>" +

"<p> test <b>BOLD</b> test</p></body></exData>";

this.value.exData.loadXML(envelope,1,1)

 

result:

Kosta_Prokopiu1_0-1623053909651.png

 

View solution in original post

sukram87
Level 1
Level 1

Hi Kosta,

thank you, that works fine 🙂 But I have the problem that it doesnt accept free lines.

I can start a new line in my text field by adding <p> and </p>. But I cant add a complete free line.

How can I do that?

 

Thanks again!

Kosta_Prokopiu1
Employee
Employee

Did you try <br/> ? Use two that should give you a newline - and make your text field multi-line