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

Text Fill Pattern - JavaScript

Avatar

16-08-2008

I am needing to get a drop-down box to change different colors depending on the users selection. I have this working fine however the last choice changes the color to a solid fill with a diagonal line pattern. The color changes but the pattern never appears.



The color should be "yellow" with black diagonal lines going from left-upper to right-lower. Please look at what i coded and tell me where I missed it.



Grantee.subform1pg1.Q11DDB.border.fill.color.value = "255,255,153";

Grantee.subform1pg1.Q11DDB.border.fill.pattern.type = "toLeft";

Grantee.subform1pg1.Q11DDB.border.fill.pattern.color.value = "0,0,0";



I greatly appreciate any insight i have changed this dozens of times.



//heres the entire script_________

****----- Grantee.subform1pg1.Q11DDB::exit: - (JavaScript, client) -------------------------------------



if (Grantee.subform1pg1.Q11DDB.rawValue == 1)

{ Grantee.subform1pg1.Q11DDB.border.fill.color.value="211,211,211"; }

if (Grantee.subform1pg1.Q11DDB.rawValue == 2)

{ Grantee.subform1pg1.Q11DDB.border.fill.color.value="255,255,153"; }

if (Grantee.subform1pg1.Q11DDB.rawValue == 3)

{ Grantee.subform1pg1.Q11DDB.border.fill.color.value="255,255,160";

Grantee.subform1pg1.Q11DDB.border.fill.pattern.color.value="0,0,0";

Grantee.subform1pg1.Q11DDB.border.fill.pattern.type="diagonalRight";

}



Met

Replies

Avatar

16-08-2008

CORRECTION:



I noticed that I copied code from two different attempts. It should read like the top not what is coded on the last lines of the entire script I posted.



Thanks.



Met

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

18-08-2008

Is the last selection the only one that uses a pattern? In Design mode, ensure the dropdown has focus and then click on the XML Source tab. The object with focus should be highlighted. Are there patterntyoe and patterncolor modes under the border nodes?

Avatar

18-08-2008

Paul,



Yes the last selection is the only one with the black diagonal lines.



The actual code is as follows in the Script Editor:



----- Grantee.subform1pg1.Q11DDB::exit: - (JavaScript, client) -------------------------------------



if (Grantee.subform1pg1.Q11DDB.rawValue == 1)

{ Grantee.subform1pg1.Q11DDB.border.fill.color.value="211,211,211"; }

if (Grantee.subform1pg1.Q11DDB.rawValue == 2)

{ Grantee.subform1pg1.Q11DDB.border.fill.color.value="255,255,153"; }

if (Grantee.subform1pg1.Q11DDB.rawValue == 3)

{ Grantee.subform1pg1.Q11DDB.border.fill.color.value="255,255,160";

Grantee.subform1pg1.Q11DDB.border.fill.pattern.color.value="0,0,0";

Grantee.subform1pg1.Q11DDB.border.fill.pattern.type="diagonalRight";

}



I'm not familiar with the focus of an object. Should I set something like this,

xfa.host.setFocus("xfa.Grantee.subform1pg1.Q11DDB");



As for the border nodes, I see no patterntype or patterncolor set anywhere. How would I confirm that there are no modes set on a node?



Thanks for your help!

Avatar

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Boost 500
Level 10
pguerett
Level 10

Likes

612 likes

Total Posts

7,689 posts

Correct Reply

692 solutions
Top badges earned
Boost 500
Boost 50
Boost 5
Boost 3
Boost 250
View profile
pguerett
Level 10

19-08-2008

If there was no pattern on the object to begin with then you cannot add a pattern to it. The nodes fill.pattern.color and fill.pattern.type do not exist in the template so you cannot change a value of something that does not exist. In Designer, can you add a pattern to that field (so that the nodes on the object exist). Then in the initialize event of the object you can set the fill.pattern.type = "" so that it looks right when you display the form to start.



Does that make sense?

Avatar

22-08-2008

Hi Met,

You can also at first set the diagonal right pattern to your dropdown in designer not script. Then you can set the pattern colors to border colors as:



if (this.rawValue == "1") { this.border.fill.color.value="211,211,211";

this.border.fill.pattern.color.value="211,211,211";

}

if (this.rawValue == "2") { this.border.fill.color.value="255,255,153";

this.border.fill.pattern.color.value="255,255,153";

}

if (this.rawValue == "3") { this.border.fill.color.value="255,255,160";

this.border.fill.pattern.color.value="0,0,0";

this.border.fill.pattern.type="diagonalRight";

}



Asiye

asiyegunaydin@kgc.com.tr

Avatar

26-08-2008

Thanks a lot for bot of your help, that worked. I was not clear on setting the node.



I'm getting much better at LiveCycle and JS though!!!