XDP Form - referencing current row DDL value and setting colour of value | Community
Skip to main content
LucreciousDFF
Level 4
March 5, 2024
Solved

XDP Form - referencing current row DDL value and setting colour of value

  • March 5, 2024
  • 3 replies
  • 1463 views

I have a paragraph number field in a repeating table row. I cannot seem to get the code correct, which is as follows:

 

form1.Page1.SubChecklist.Table.Detail.ParaNum::ready:layout - (JavaScript, client)

var vCurrentRow = this.parent.index;
if (Table.Detail[" + vCurrentRow + "].DDLAlign.rawValue == "No" || Table.Detail[" + vCurrentRow + "].DDLPrompt.rawValue == "No"){
if (xfa.host.version < 😎😎{
this.resolveNode("$").fontColor = "249, 11, 8";

}
else {
var CaptionColorBackup = this.resolveNode("$").caption.font.fill.color.value;
this.resolveNode("$").font.fill.color.value = "249, 11, 8";
this.resolveNode("$").caption.font.fill.color.value = CaptionColorBackup;

}
}

 

The above script is running on the field "ParaNum" as indicated. If I use a "this." reference, the color change triggers properly for the first row.

 

In attempting to write the appropriate code for repeating rows, I cobbled together the above code, which, does not trigger.

 

I know I am missing a fundamental within the code so I am asking for help here as I cannot figure out why the code is not triggering. 

 

The check is on values further in the row which have the value of "No" and sets the paragraph number field to red.

 

The "< 8)" disappears in the code above for Acrobat versioning. Please disregard this in the above.

 

Please help.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by LucreciousDFF

@morismonk 

 

This worked for me:

var rowCount = Table._Detail.count;
for (var i=0;i<rowCount;i++)
 
if (Table.Detail.all.item(i).DDLAlignment.rawValue == "No" || Table.Detail.all.item(i).DDLPrompts.rawValue == "No" || Table.Detail.all.item(i).DDLPunctuation.rawValue == "No" || Table.Detail.all.item(i).DDLSpelling.rawValue == "No" || Table.Detail.all.item(i).DDLWidow.rawValue == "No" || Table.Detail.all.item(i).DDLProgram.rawValue == "No" || Table.Detail.all.item(i).DDLIVData.rawValue == "No" || Table.Detail.all.item(i).DDLNoPub.rawValue == "No"){
if (xfa.host.version <8) {
  Table.Detail.all.item(i).ParaNum.fontColor = "249, 11, 8";
 
  }
  else {
  var CaptionColorBackup = this.resolveNode("$").caption.font.fill.color.value;
  Table.Detail.all.item(i).ParaNum.font.fill.color.value = "249, 11, 8";
  Table.Detail.all.item(i).ParaNum.caption.font.fill.color.value = CaptionColorBackup;
 
  }
}

 

3 replies

Level 4
March 6, 2024

Have you tried with

if (DDLAlign.rawValue == "No" || DDLPrompt.rawValue == "No") {

LucreciousDFF
Level 4
March 6, 2024

Yes, some time ago, and, that works for the first row. However, for subsequent rows it does not.

All the fields are within the same row, and, the issue I see is that the instanceManager iteration of the field (or row) is not being referenced for subsequent rows or correctly for the initial row. From the start, there is only one row, and, depending on the user needs they can enter a number to add many additional rows.

Therefore, the reference to instanceManager and using that value within the row fields may be needed. However, my approach is not working. That is where I need to have the code fixed. Perhaps the row should hold [*] for the instanceManager iteration or a code change to the way I have written it above.

LucreciousDFF
Level 4
March 6, 2024

Requesting assistance with this from @radzmar on this topic.

LucreciousDFF
LucreciousDFFAuthorAccepted solution
Level 4
March 7, 2024

@morismonk 

 

This worked for me:

var rowCount = Table._Detail.count;
for (var i=0;i<rowCount;i++)
 
if (Table.Detail.all.item(i).DDLAlignment.rawValue == "No" || Table.Detail.all.item(i).DDLPrompts.rawValue == "No" || Table.Detail.all.item(i).DDLPunctuation.rawValue == "No" || Table.Detail.all.item(i).DDLSpelling.rawValue == "No" || Table.Detail.all.item(i).DDLWidow.rawValue == "No" || Table.Detail.all.item(i).DDLProgram.rawValue == "No" || Table.Detail.all.item(i).DDLIVData.rawValue == "No" || Table.Detail.all.item(i).DDLNoPub.rawValue == "No"){
if (xfa.host.version <8) {
  Table.Detail.all.item(i).ParaNum.fontColor = "249, 11, 8";
 
  }
  else {
  var CaptionColorBackup = this.resolveNode("$").caption.font.fill.color.value;
  Table.Detail.all.item(i).ParaNum.font.fill.color.value = "249, 11, 8";
  Table.Detail.all.item(i).ParaNum.caption.font.fill.color.value = CaptionColorBackup;
 
  }
}