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.
Solved! Go to Solution.
Views
Replies
Total Likes
This worked for me:
Have you tried with
if (DDLAlign.rawValue == "No" || DDLPrompt.rawValue == "No") {
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.
This simplified code works ONLY on the first row:
form1.Page1.SubChecklist.Table.Detail.ParaNum::ready:layout - (JavaScript, client)
if (this.DDLAlign.rawValue == "No" || this.DDLPrompt.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;
}
}
If that code is in ParaNum::ready:layout then I believe it should work.
FYI I did a little test and it works for me.
Yes, as I mentioned it does work. but, ONLY on the first row. Not additional rows added via instanceManager.
I believe what is required is code which references the instanceManager to identify the current instance and therefore the color change for NOs on DDL values will change THAT row's paragraph number text color.
Just to clarify, what you are trying to achieve works for me i.e. each row working as expected, not ONLY the first row.
Moris, I appreciate the input and contribution. The rows are dynamically created. At the outset the table has only ONE row. The user then can set the number of rows needed. As such, the rows that are generated have a dynamic name. These are new rows that exist only after the user sets the number of rows they require, they are iterations of the initial row. So, referencing the fields in the row may require code to identify the instanceManager generated row names. As such, it only works on the first row on my form.
This worked for me: