Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Using TableRow Index to set ReadOnly

Level 5
Level 5
I have a dynamic table that adds a new row whenever the button beside it is clicked. Pretty simple. When a new row is added there are two cells (text fields) that the user is supposed to enter. One of the cells contains an OK button. When the user clicks the OK button, I would like the entire corresponding row to be set to readOnly, so the values can no longer be edited.

I figure there is some way of accessing a single instance in a table using an index, but I cannot figure out the syntax. Everything I try always changes the first row in the table. Does anyone have any suggestions or help?

Thank you so much!
2 Replies
Level 10
Level 10
To get the index you would use this.parent.index. This will tell you which instance you are working with. Now that you know the instance you can address each of the objects by using the appropriate SOM Expression. To get the som expression I put an app.alert(this.somExpression); This will show you the structure you need to follow. The container for your object will have the instance number on it (i.e. form1[0].Page1[0].subform[*].fieldname[0] ...where * is the instance number.

Now when you go to set a value you cannot use [ ] in javascript so to create the expression you need this syntax:

xfa.resoleNode("form1.Page1.subform[" + this.parent.index + "]").fieldname.rawValue

Make sense?