Another border.fill.color.value question

Avatar

Avatar

arpynrp

Avatar

arpynrp

arpynrp

17-08-2009

I am trying to script an if statement to define the background value depending on the instanceIndex of a subform.  I have tried it in the click event of the addButton and the indexChange event of the subform.  I saw an example of exactly what I am trying to do, but for the life of me I cannot locate it now.  I have searched both this forum and the users forum and I know it was in one of them.  Anyway, here is what the script looks like:

----- form1.Main_Subform.AdditionalAssaysSubform::indexChange: - (JavaScript, both) ----------------

if

(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "0") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "240,240,240";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "2") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "240,240,240";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "4") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "240,240,240";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "6") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "240,240,240";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "8") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "240,240,240";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "240,240,240";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "1") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "255,255,255";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "3") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "255,255,255";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "5") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "255,255,255";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "7") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "255,255,255";

}

else

if(form1.Main_Subform.AdditionalAssaysSubform.instanceIndex == "9") {

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDropdown.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssaysDataTable.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayAvgNeg.border.fill.color.value

= "255,255,255";

form1.Main_Subform.AdditionalAssaysSubform.AddedAssayDisplacement.border.fill.color.value

= "255,255,255";

}

I have also tried to use the or ( | ) and combine the if's.  My question is... Am I using the correct event; am I placing the conditional statement in the appropriate place; or am I out in left field again?  Any suggestions would be very appreciated.  Thanks in advance. -rpeterson

View Entire Topic

Avatar

Avatar

Yasser__AST-IT_

Avatar

Yasser__AST-IT_

Yasser__AST-IT_

03-09-2009

Hi Hélène,

Many thanks for your answers...I started going through the links and reading the stuff. I've gone through the LC Designer Scripting Reference on the previous versions, looking at the 8.2 version of the reference, it seems they have the same issue of not sufficient examples/explanations on how to access non-common features/properties. 

The problem I'm facing is I think in understanding the grammer of XFA and referencing in some special cases such as dealing with non-interactive objects.

The case I'm trying to implement is as following: In our form, there will be visual indicators(3 circles - it's like traffic light) that will show the status of specific section of the form. The circles will be by default set filled by gray color, and depending on the values collected from the section's fields (based on certain logic) one of the circles will be filled by either Red, Yellow, or Green color.

Currently, I'm using two objects (on top of each others) for each circle (one filled with gray and the other one is filled with, for example, green color), and using presence to hide and unhidden the required "colored" objects. But as you can see, this method is not the best and having access to the object's visual properties is better coding practice (I assume)

I'm hoping to get the required assistance on the "how to" from this forum...

🙂

BR,

Yasser