My form has a table that the user can add/remove rows as desired.
I am looking for a way to allow the user to copy the table mentioned above into a second, third, etc. instance. I want the subsequent instances to have the same number of rows and have the same text as entered in the first instance.
Looking for a solution to this in JavaScript.
Views
Replies
Total Likes
Hi,
Your code will need to know how many instances the original table has so you know how many instances in the other tables to make. You will then need to make the rawValue of the target table cell the same as the original table cell. To do this you need to send the rawValue to the correct row (instance).
See this link for some information about referencing row instances directly.
Views
Replies
Total Likes
Thanks for the response.
I would like the user to dynamically be able to repeat the table as many times as needed so I don't think your code in the link will work for me. Referencing your example, I would need multiple instances of Table1 - I won't have a Table2.
Views
Replies
Total Likes
Hi,
Another instance of Table1 would still be Table1, but be referenced using an instance parameter Table1[0]. For Example:
Instead of having this.resolveNode("Table1[2].Table1.Row1.TextField1").rawValue = "text in third instance";
you could easily have
this.resolveNode("Table1[2].Table1.Row1.TextField1").rawValue = this.resolveNode("Table1[0].Table1.Row1.TextField1").rawValue;
This would put the value in the textfield in the original instance into the same field in the third instance. You could shorten the code by counting instances and using a variable or you could just write a very long code accounting for a maximum number of subform instances.
Does that help?
Views
Replies
Total Likes
Thank you! This helps - I am getting closer.
I can now add a second instance of Table1 with the same number of rows as the first instance.
Now I need help creating my loop functions... I am not experienced in Javascript so examples are helpful.
I think I will need two loop functions or nested loop functions: Copy text fields from the first table instance to x table instance for y number of rows
Views
Replies
Total Likes
Glad to have helped out.
Loops are not my thing, but if you search the forum you should be able to find some examples. The LC help is rather lacking when it comes to loops.
Views
Replies
Total Likes
Views
Likes
Replies