cancel
Showing results for 
Search instead for 
Did you mean: 

Problem accessing dynamically created table line

Former Member
0 Kudos

Hi everyone.

I'm unable to solve the following problem:

In an offline scenario I have a table which contains one line at creation time. The form offers a button to add lines to the table using javascript and the instanceManager of the table.

If the added lines are beeing filled by the user I can extract that data without a problem.

But I cannot acces the newly generated fields with java script.

I'm not sure, what the problem is. Here is the code, which should do the job:

xfa.resolveNode("xfa.form.data.Inhalt.CONTACTS.DATA.NAMEV[" + position + "]").rawValue = 'Andreas';

This works fine, for the table line, that exists right from the beginning(position = 0), but not for any added line.

I keep getting this error: xfa.resolveNode("xfa.form.data.Inhalt.CONTACTS.DATA.NAMEV[" + position + "]") has no properties

What am I doing wrong?

Thanks for any hints,

Andreas.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member226239
Contributor
0 Kudos

I think in your case you are getting that message because the new line hasn't been added successfully.

After adding the instance(row) to the table use: xfa.form.recalculate(1);

If it doesn't solve your problem then please let us know the Java script code you wrote to add the new line.

Thanks,

Chandra Indukuri

Former Member
0 Kudos

Hi and thanks for your reply.

I had that thought too and tried it out earlier with no success. Also I tried adding lines and filling those in separate scripts with separate buttons. Didn't make any difference.

OttoGold
Active Contributor
0 Kudos

I am not sure if that will help you in any way, but if you don´t need to access the rows in some special way, you could benefit from the indirect/ relative adressing. If you want to manipulate the row based on the data in that row, why don´t you use "this" pointer and place the script on the subform of the row? I understand that doesn´t help for all cases, but could help in few.

Regards Otto

Former Member
0 Kudos

Thank you for your response.

In my case your suggestion does not work I think, because the script is triggered by a drop down list. When the user choses a value, a table row is added and the chosen name should be set to the new line.

OttoGold
Active Contributor
0 Kudos

Ok then, maybe you could try to use this "addressing" approach, maybe it could help you further:

(i mean how the guys here concatenate the address string)

Otto

Former Member
0 Kudos

Solved the problem now and it was fairly easy looking at it now.

I don't know, why the above mentioned adressing does not work, but it works like this:

var tab = xfa.resolveNodes("xfa.form.data.Inhalt.CONTACTS.DATA[*]");

// get the last position

var last = xfa.resolveNodes("xfa.form.data.Inhalt.CONTACTS.DATA[*]").length - 1;

// fill values

tab.item(last).NAME1.rawValue = "Andreas";

Edited by: Andreas Heckele on May 17, 2010 11:07 AM