Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list
SOLVED

Test for existence of field on form

Avatar

Level 2

Hello,

How do I test, using JavaScript, whether a specific field exists on a form or not?  I tried the following, but not  quite working:

if (xfa.layout.absPage(pg1.sfCap.sfCapLeft.Table2.Row2) == -1 )

{

}

Note: For the form where I tried this, the Row2 does not exist at all

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

The resolveNode function (see http://help.adobe.com/en_US/livecycle/9.0/designerHelp/001395.html) can be used to retrieve the value of a specific node within a table row. You will still need to determine the row count and iterate over the table row instances in conjunction with resolveNode().

Steve

0 Replies

Avatar

Level 10

You could test if the row count of a table. For example, form1.page1.subform1.table._row.count could be compared to form1.page1.subform1.table._row.occur.min to test if a new row had been dynamically added to the form.

Steve

Avatar

Level 2

So there's no exists() function that can return whether an item is found on a form or not?  I'm trying to create a fragment that will work for multiple forms, but part of the solution is that it must be able to determine if a certain item exists on a form AND that the code does not fail just because the item isn't found at all.  Thanks.

Avatar

Correct answer by
Level 10

The resolveNode function (see http://help.adobe.com/en_US/livecycle/9.0/designerHelp/001395.html) can be used to retrieve the value of a specific node within a table row. You will still need to determine the row count and iterate over the table row instances in conjunction with resolveNode().

Steve

Avatar

Level 2

Thanks; I'll give that a try.