Expand my Community achievements bar.

Adding value to instances fields?

Avatar

Level 6
Hi,



I add some instances to a form programatically with setInstances() method. However, I can´t figured out how to assign values to the fields on those instances.



Any example?



Thank you
1 Reply

Avatar

Former Community Member
I would suggest not using setInstances() if you need to immediately edit field values in the added subforms. It's possible, but there are easier ways. What I would do is to use a loop and the addInstance() method. And edit the values in the subform reference that is returned by addInstance(). So it would look something like this:



for (i = 0; i < 4; i++) {

var myRow = SubForm.instanceManager.addInstance(true);

myRow.textField.rawValue = "someValue";

}



Chris

Adobe Enterprise Developer Support