All instances of object in master page

DKinsley 16-08-2016

I have a Text Field object at the top of my master page. When the user selects from a drop down object, the Text Field's background color needs to change from white to either green, yellow or red. I created the script in the change event of the drop down and it works correctly until a second page is dynamically created as a result of text the user added to other fields. How do I select all instances of the Text Field?

Here's my script:

Form1.Subform4.Table2.Row1.Overall[0]::change - (JavaScript, client)

if ($.boundItem(xfa.event.newText) == "Green") {

  xfa.resolveNode("#pageSet.Page1.OverallTop").border.fill.color.value = "204, 255, 204";//green color

}

if ($.boundItem(xfa.event.newText) == "Red") {

  xfa.resolveNode("#pageSet.Page1.OverallTop").border.fill.color.value = "204, 255, 204";//red color

}

if ($.boundItem(xfa.event.newText) == "Yellow") {

  xfa.resolveNode("#pageSet.Page1.OverallTop").border.fill.color.value = "255, 255, 0";//yellow color

}

Accepted Solutions (1)

Accepted Solutions (1)

alassir 17-08-2016

Hi DKinsley ,

I have had a similar Problem, and solved it this way:

You need to amend the JavaScript code in that way, that you change every instance on every masterpage, where the item is inherited.

In you case the code should look probably like this:

Form1.Subform4.Table2.Row1.Overall[0]::change - (JavaScript, client) 

  • if ($.boundItem(xfa.event.newText) == "Green") { 
  •   xfa.resolveNode("pageSet.NameofMasterpage[0].OverallTop").border.fill.color.value = "204, 255, 204";//green color 
  • if ($.boundItem(xfa.event.newText) == "Red") { 
  •   xfa.resolveNode("#pageSet.NameofMasterpage[1].OverallTop").border.fill.color.value = "204, 255, 204";//red color  --> this is the same color as above
  • if ($.boundItem(xfa.event.newText) == "Yellow") { 
  •   xfa.resolveNode("#pageSet.NameofMasterpage[2].OverallTop").border.fill.color.value = "255, 255, 0";//yellow color 

I'm not that good in coding, so perhaps the code still needs to get running, but I hope it Points you to the right direction.

Best

Dietmar