Expand my Community achievements bar.

SOLVED

Loop validating newly added rows

Avatar

Level 2

Hello dear livecycle fans!

I think that I looked everywhere for my rather simple question. Here it is:

I have a table with a header row and 1 row and a New Row button (which adds a new row to the table) BUT I want that button to validate the last row (to check if everything is fullfilled). It may also validate all rows, doesn't really matter.

My code looks like this:

var valid = true;

      for (var i=1; i < Table1.Row.instanceManager.count; i++)
{
if (form1.page1.tabform.Table1.Row(i).field.rawValue == null || form1.page1.tabform.Table1.Row(i).field.rawValue.length == 0); {
xfa.host.messageBox("You are missing a field!");
valid=false; }
}

Of course when the valid = true it adds new row. However - this validation doesn't work
why is that? Would you be so kind and help me out with one. The code looks simple and straightforward and I really don't know what I'm doing wrong.

Thank you! PS. wow this post editor is really messed up on Opera

1 Accepted Solution

Avatar

Correct answer by
Level 2

OK, I found this blog post which answers all my questions:

http://blogs.adobe.com/formfeed/2008/11/loop_through_subform_instances.html

1 Reply

Avatar

Correct answer by
Level 2

OK, I found this blog post which answers all my questions:

http://blogs.adobe.com/formfeed/2008/11/loop_through_subform_instances.html