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

Change color of button master page

Avatar

01-12-2008

Hello,



I've been working on this for 2 weeks and can't figure it out. Any help would be appreciated.



I have a button (btn1) on my master page (mPage). I want to change the color of this button to red when the user chooses one radio button (radiobtn) on page 2 of a 3 page form. After that, the master page btn1 will be red for all the user pages (pages 1 through 3). Any idea how to do this?



Any ideas?



Thanks,

Ralph

Replies

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

01-12-2008

Depends on which language you choose. Each button has a unque name based on the occurance number of its parent subform (assuming the parent subform in the Master page is called Page1). You can see this by adding the javascript code this.somExpression to the master page button. You will see that the expression is generally of the format form1.pageSet.Page1[occuranceNumber].ButtonName. You will have to address each one individually to change it. The parameter you want is: buttonname.border,fill.color.value = "R value, G value, B value"



This is a case where FormCalc has an advantage because you can use the * in the occurance number to reference all occurances of the Button.



If you choose to use Javascript you will have to determine how many occurances of pageSet.Page1 there are then loop through each one using a for loop to get each separate ocurance and setting it one by one. Note that in javascript the [] are interprestted as an array index so you will have to use the cfa.resolveNode syntax like this (assuming i is the counter in your for loop):



xfa.resolveNode("form1.pageSet.Page1[" + i "]").ButtonName.border.fill.color.value = "255,0,0";

Avatar

07-12-2008

Paul,



Thank you for your help. Your suggestion definitely works but I can't figure out how to solve 1 glitch. I can change the button color on any master page as you suggested. However, if any subform on that page recalulates, the master page button goes back to the original color. Could you please let me know what I am doing wrong?



Thanks,

Ralph

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

08-12-2008

That is because the page is layed out again each time. The button is being reset to its original state. You can put your test on the calculate event. That event will get fired each time the page is layed out.

Avatar

08-12-2008

Thanks much. I knew it must be straightforward. Paul, you are great. We appreciate your help on this forum.



Ralph