Hi all,
I am trying to figure out how to create an action for my form in Livecycle Designer ES2 that will affect the most recent instance of a dynamic table row. I have a table with a repeatable row where the user will enter information about a purchased part and I have buttons that allow the user to add and remove rows. I need to create an additional add row button that will add a new instance of the repeatable table row (this is not an issue) and will disable and change the background color of the first cell in the added row. The problem I am having is how to have an action that affects the last instance of a row.
If anyone knows how to do this in Javascript I would appreciate some advice/help.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi,
I think this is beyond what an action will provide. You will a have to write some JavaScript directly. When you call the addInstance method it returns the new row, so you can do something like;
var row = Table1._Row1.addInstance();
row.TextField1.border.fill.color.value = "255,0,0";
row.TextField1.access = "protected";
To find the last row and do the same thing you can do something like;
var row = Table1.resolveNode("Row1[" + (Table1._Row1.count - 1) + "]");
row.TextField1.border.fill.color.value = "255,0,0";
row.TextField1.access = "protected";
Regards
Bruce
Views
Replies
Total Likes
Hi,
I think this is beyond what an action will provide. You will a have to write some JavaScript directly. When you call the addInstance method it returns the new row, so you can do something like;
var row = Table1._Row1.addInstance();
row.TextField1.border.fill.color.value = "255,0,0";
row.TextField1.access = "protected";
To find the last row and do the same thing you can do something like;
var row = Table1.resolveNode("Row1[" + (Table1._Row1.count - 1) + "]");
row.TextField1.border.fill.color.value = "255,0,0";
row.TextField1.access = "protected";
Regards
Bruce
Views
Replies
Total Likes
Hi
I have a similar problem I need to resolve. I my case have a field called ContactP, which is placed in Row1 of a Table called ContacT which is placed in a repeating subForm called AddContact. I need to get the value of ContactP in last instance of the repeating subForm. Any suggestions how to do this.
Views
Replies
Total Likes
Hey there,
technically it's the same process as Bruce mentioned above. Simply use the resolveNode method to access the desired repeated subform by calling its count property by using the instanceManager with one of these ways:
_AddContact.count - 1 //or AddContact.instanceManager.count - 1
//result
PageName.resolveNode("AddContact[" + (PageName._AddContact.count - 1) + "].ContactT.Row1.ContactP.rawValue");
In the case that you have to specify which instance of Row1, you would have to add an additional resolveNode or additional xPath for it to access the instance desired
I hope this will help.
Thank You so much
Views
Replies
Total Likes
The table in Desinger has rows based on index starting from 0, so as Bruce has advised, you can get the count of the rows and count - 1 will give you the latest added row instance index, which can be used to manipulate the row.
var rowCount = Table.Row.count;
Table.Row[count-1].textField.access = "";
Regards -
Ashok D
Thank you for your help. I have had to learn Javascript myself, so I am not as proficient as I could be. I knew that it should be possible to use count - 1 to specify the last row instance, but I didn't think (or know how) to use a variable to define this. Thank you for your help.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies