Expand my Community achievements bar.

Join us in celebrating the outstanding achievement of our AEM Community Member of the Year!

Javascript in PDF vs HTML and debugging

Avatar

Level 7

We are displaying forms using 6.5 as HTML with great success however, there are a few forms using some javascript that doesn't seem to translated.

 

The particular line of code that seems to be acting different from PDF to HTML is this line:

 

var root = xfa.resolveNodes("xfa.record.mynode[*]")

 

In PDF, root.length = 2 whereas in HTML, root.length = 0.  

 

Any ideas how to mitigate?  How do you traverse XML data in HTML?

More importantly, what are debugging techniques in HTML?  Can I step through the scripts?

1 Reply

Avatar

Community Advisor

HI @crich2784 ,
 xfa.resolveNode starts a search with the current container and work its way up the hierarchy tree. The 1st occurance found will be returned to you. 

The value passed to resolveNode is a string.....so when dealing with fields that have occurance number [1] or unnamed subforms #subform both of those expressions have chars in them that javascript will interpret the wrong way (i.e. brackets are used for arrays). So by using a resolveNode('Som expression") you can referece these objects direclty (no search is needed as you are pointing to the particular object). For example xfa.resolveNode("form1.Page1.subform1.Object[1]").rawValue. In this case the som expression points to the direct object and no search is required. This notation is very helpful when using a for loop and affecting many objects with the same name (they woudl use occurance numbers) as you can manipulate the sting for your needs: i.e. xfa.resolveNode("form1.page1.subform1.Object[" + i + "]").rawValue where i is a variable that is set outside the expression.

 

In HTML you can try to look for the value of "root". Try to display this in your UI by that way you can get some idea.

 

 

-Tarun

 

 

 

 

-Tarun