Expand my Community achievements bar.

Get default row fillColor value

Avatar

Former Community Member

Hello,

Sorry for my english it's not my native language.

The problem i have is that i am using a table that grow each time a row is filled in.

When some value's are chosen in a dropdownlist the backgroundcolor has to change in red.

This part is working good already.

The problem is that the table has alternating row shading.

So when the specified values are chosen the color changes to red.

But when the form filler chose another value the color stays red.

Now i want to get the default fillColor value as a variable and use it for the else color.

So the variable = the default background color of the alternathing row.

This i the code i got already:

form1.InventarisKoelinstallaties.Subform4.Table1.Row1.Cell8::change - (JavaScript, client)

var RowDefaultColor = Row1.fillColor();

if (xfa.event.newText == "R22"){

Row1.fillColor = "255,0,0";

}

else if (xfa.event.newText == "R12"){

Row1.fillColor = "255,0,0";

}

else if (xfa.event.newText == "R409a"){

Row1.fillColor = "255,0,0";

}

else if (xfa.event.newText == "R408a"){

Row1.fillColor = "255,0,0";

}

else{

Row1.fillColor = "RowDefaultColor";

}

I hope someone can help me.

1 Reply

Avatar

Level 8

What you want to do is access the template object (as it exists in Designer) of your subform. Here's a function I found awhile back that John Brinkman wrote:

function findTemplateField(vField)

{

var vSOM = vField.somExpression.replace(/\[[0-9]*\]\./g, ".");

vSOM = vSOM.replace(/xfa\.form/, "$template");

return xfa.resolveNode(vSOM);

}

Put that any where in your change event or even reference it through a script object, your choice.

Edit the final else line in your code to:

Row1.fillColor=findTemplateField(Row1).fillColor;

Kyle