cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Input field creation - issue with bindValue in loop

Former Member
0 Kudos

Hello,

I am creating context node elements at runtime. My node looks like this -

LocalNode

Question

Answer


for(int i;i<wdContext.nodeLocalNode.size();i++)
{
wdContext.nodeLocalNode().setLeadSelection(i);
  IWDTextView TV1 = (IWDTextView)view.createElement(IWDTextView.class,"TV"+i); 
  TV1.setText(wdContext.currentLocalNodeElement().getQuestion()); 
   mainGrp.addChild(TV1); 
   IWDInputField IP1 = (IWDInputField)view.createElement(IWDInputField.class,"TE"+i);                              
  IP1.bindValue("LocalNode.Answer");
   IP1.setValue(wdContext..currentLocalNodeElement().getAnswer()); 
   mainGrp.addChild(IP1); 
}

Please note: Question column is the textView and Answer column is the input field

The output should be as follows-

Question Answer

Header None

How Many 7

Comments Maybe valid

Do you agree Yes

Although the text view displays correctly, the input field only shows the last record value and the output currently displays as follows-

Question Answer

Header Yes

How Many Yes

Comments Yes

Do you agree Yes

What am I doing wrong here?

How can I bind the corresponding values to the input field in a loop?

Regards,

Nisha

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Solved by creating a new dynamic node for every iteration.

Former Member
0 Kudos

Hi,

Could you please provide the code .

Regards,

Sunil.