Expand my Community achievements bar.

Referencing additional instances using JavaScript

Avatar

Former Community Member
Thanks for the help in advance.



Sorry I am new to JavaScript. I am having instance issues. I have a line of code that adds instances of a table and a text field and works great.



Here is the code:

Form1.Body.AddLine.btn_AddLine::click - (JavaScript, client)

Item.instanceManager.addInstance(1);



But when this code runs on the exit it still changes the first instance of the object. It will not change additional lines after they have been added?



Form1.Body.Item.Item_Description::exit - (JavaScript, client)



if(Body.Item.Item_Description.rawValue = "Scissors")

{

xfa.host.messageBox("Please fill in Bottom Chord Pitch")

Body.Item.Add_Notes.rawValue = "Bottom Chord Pitch:_________"

xfa.host.messageBox("Please fill in Seat Cut")

Body.Item.Add_Notes.rawValue = Body.Item.Add_Notes.rawValue + " Seat Cut:_________"

xfa.host.messageBox("Please fill in Bearing")

Body.Item.Add_Notes.rawValue = Body.Item.Add_Notes.rawValue + " Bearing:_________"

}

;



Thanks, Leo Snetsinger
1 Reply

Avatar

Former Community Member
Each line has its own instance and the instance number is on the subform and not the object level. So your expression should be:



Body.Item[2].Add_Notes.rawValue = "Bottom Chord Pitch:_________"



If you try to address the object instance with a variable then you would use this type of expression:



xfa.reolveNode("Body.Item[2]")Add_Notes.rawValue