Expand my Community achievements bar.

SOLVED

Changing Color of Text

Avatar

Level 3

I'm looking for a way to change color of the font when a certain person reviews the document.  After the document has been signed then the reviewer goes in to make the changes.  Is there a way for when the reviewer types in the changes the text color is different??

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

The attached contains examples of changing text field properties through script. For example, to change font colour.

// form1.page1.subform1.cb4::change - (JavaScript, client)

if (this.rawValue == 1) {

          xfa.resolveNode("form1.page1.subform1.tf.font.fill.color").value = "255,255,0";

}

else {

          xfa.resolveNode("form1.page1.subform1.tf.font.fill.color").value = "0,0,0";

}

Steve

View solution in original post

6 Replies

Avatar

Level 10

You can change the font color dynamically by using the syntax below..

FieldName.font.fill.color.value = "0,0,255"; //(Provide the RGB numbers).

Thanks

Srini

Avatar

Level 3

But is there a way to assign that color to a certain user?

Avatar

Level 10

You can. But the PDF should know who the user is when the form is opened.

For example, if you are using a server side rendering, you can pass the logged in user info in the data file before rendering.

If you are not using the Server side rendering, then you can assign a value to a hidden field when the form is submitted to a reviewer. In the initialize event of the field, you can check the the hidden field value and if it matches to reviewer, then you can change the font color.

If you want to do the second approach, the you need to make sure you set the "Preserve scripting changes to form when saved" to Automatically in the File menu -> Form Properties and in the Default tab.

Thanks

Srini

Avatar

Level 3

Can you maybe post an example script.  I'm still somewhat new with all this LiveCycle scripting stuff.  Thanks.

Avatar

Correct answer by
Former Community Member

The attached contains examples of changing text field properties through script. For example, to change font colour.

// form1.page1.subform1.cb4::change - (JavaScript, client)

if (this.rawValue == 1) {

          xfa.resolveNode("form1.page1.subform1.tf.font.fill.color").value = "255,255,0";

}

else {

          xfa.resolveNode("form1.page1.subform1.tf.font.fill.color").value = "0,0,0";

}

Steve

Avatar

Level 3

Ok I got the script to work so is there a way to possibly lock in the color of the text that is already there and then when new text is typed - that can be a different color?

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----