Expand my Community achievements bar.

Unable to change button bg color in Masterpage

Avatar

Former Community Member

I have 2 buttons (ButtonShow and ButtonHide) that I have inserted in my masterpage 1. These buttons control the object elements in design page and chooses either to show or hide the fields depending on the selection. These are the scripts I have for these buttons:

ButtonShow script:

pageSubform.HeaderWrap.DropDownList1.presence = "visible";

pageSubform.HeaderWrap.TextField1.presence = "visible";

this.border.fill.color.value = "255,140,26";

ButtonHide.border.fill.color.value = "212,208,200";

ButtonHide script:

pageSubform.HeaderWrap.DropDownList1.presence = "invisible";

pageSubform.HeaderWrap.TextField1.presence = "invisible";

this.border.fill.color.value = "255,140,26";

ButtonShow.border.fill.color.value = "212,208,200";

My Problem: Although the above script works in hiding or showing the objects, the background color of the ButtonHide does not change for some reason. However, these buttons works perfectly if I move these buttons from Masterpage to the design page. When placed in the design page, it hides the objects as well as changes the bg color of the buttons. But when I place these button inside the masterpage1, it does not change the bg colors for some reason when ."ButtonHide" is clicked. I dont understand why that is...I was also reading around in the forums and I read somewhere by Niall O'Donovan that "If your script is in an object on the Master Page then relative references should work. However if your script is in an object on the Design Pages and you are referencing objects on the Master Page in the script, then you will need to resolve the node." So I tried the code with the resolveNode method like this and it still does the same, meaning the bg color doesnt change although it hides the fields:

Alternative ButtonHide script:

this.border.fill.color.value = "255,140,26";

ButtonShow.border.fill.color.value = "212,208,200";

xfa.resolveNode("xfa.form.form1.pageSubform.HeaderWrap.DropDownList1").presence = "invisible";

xfa.resolveNode("xfa.form.form1.pageSubform.HeaderWrap.TextField1").presence = "invisible";

However, I noticed that the bg color changes if I remove these 2 lines from the code:

xfa.resolveNode("xfa.form.form1.pageSubform.HeaderWrap.DropDownList1").presence = "invisible";

xfa.resolveNode("xfa.form.form1.pageSubform.HeaderWrap.TextField1").presence = "invisible";

I dont understand this strange behaviour and why its happening...hopefully someone can shed some lights....thanks for reading my post..

5 Replies

Avatar

Level 10

Place your code between TRY...CATCH block and find out the error information.

Or send your form to nith.igate@gmail.com . I will have a look at it.

Nith

Avatar

Former Community Member

thank you Nith....I have just created a sample file that shows the problem I am experiencing. I have got this file in file sharing and here is the link: https://acrobat.com/#d=fs-E6Bqml8r0FWI8aMu09g

If you have a look at the pdf in the above url, you will notice that I have placed the "Show" and "Hide" buttons in both the masterpage as well as the design page. The buttons works fine whens its placed inside the design page but the buttons doesnt work properly when its in the masterpage like I had mentioned in my first post. I cant understand why that is...

Hopefully you can help me understand...Thank you for your time...

Cheers,

Neel

Avatar

Former Community Member

can anyone help me with this plz?? I would prefer to have these elemets in my masterpage but I cant understand why the bg color doesnt change when the fields are placed inside the masterpage..I am still stuck on this and havent moved forward yet...

any help will be appreciated...has anyone got any ideas plz?

Avatar

Former Community Member

I am yet to resolve this issue...has anyone got any ideas? Why am I unable to change the background colors of buttons placed in masterpages on a click event? Is there a limitation with Adobe on this?