XDP Form - Referencing fields within dynamic rows of a Table | Community
Skip to main content
LucreciousDFF
Level 4
March 7, 2024
Solved

XDP Form - Referencing fields within dynamic rows of a Table

  • March 7, 2024
  • 1 reply
  • 568 views

I need JavaScript help with field referencing within a dynamically generated table row.

I have the following code which only triggers within the first row, which is the only row in the table prior to the user generating additional rows.

 

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

 

if (this.DDLAlignment.rawValue == "No" || this.DDLPrompts.rawValue == "No" || this.DDLPunctuation.rawValue == "No" || this.DDLSpelling.rawValue == "No" || this.DDLWidow.rawValue == "No" || this.DDLProgram.rawValue == "No" || this.DDLIVData.rawValue == "No" || this.DDLNoPub.rawValue == "No"){
if (xfa.host.version <8) {
this.fontColor = "249, 11, 8";

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

}
}

 

The above code works to change the ParaNum field value to red when there is any of the DDLs that have a value of "No".

 

But ONLY on the initial row. Not for any dynamically generated rows.

I asked about this in another post, however, it may not have been clear as to what I was attempting to do.

 

Please assist with the coding above, I am aware that instanceManager and dynamic rows changes the underlying row names, I just cannot figure out how to address it within the code above.

Thank you in advance...

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

This worked:

 

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;
 
  }
}

 

1 reply

LucreciousDFF
LucreciousDFFAuthorAccepted solution
Level 4
March 7, 2024

This worked:

 

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;
 
  }
}