Expand my Community achievements bar.

SOLVED

Adding instances dynamically fail on FormServer

Avatar

Former Community Member

Dear All,

I am facing an issue while adding instances of a subform dynamically by resolving an XML whose hierarchy is different from that of PDF hierarchy.


Issue : Added instances of a subform not working in FormServer(working on local machine) when trying to resolve XML which is different from

           PDF nodes hierarchy.

Adobe Reader Version     : 9.0

Adobe LiveCycle Designer : 7.0

Code written at : Initialization of Parent of the subform which should repeat.

Script used is:

var FundDataArrayNode = "xfa.record.FundDataArray";

if(xfa.resolveNode(FundDataArrayNode )!=null)

{

     for (i=0;I<10;i++)

     {

          Add instances of subform "x"

     }

}

XML contains following data:

         

<WIP xmlns:ns0="http://schemas.ml.com/CCP/Standards/Common/WIP_v2_0/">

<FundDataArray>

</FundDataArray>

</WIP>

I am trying to resolve for the "FundDataArray" node and if it is available i am trying to add 10 instances using "for" loop. This is working fine on Local Machine but not on Form Server.

If i don't resolve for the node, and add instances using simple "for" loop, it works fine on local machine as well as on Form Server.

As i am not able to attach PDF, let me know to which mail id i can send the PDF and XML.

Please advice.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Try like this..

Use JavaScript as language..

if(xfa.resolveNode("$record.FundDataArray").value!=null)

{

     for (i=0;I<10;i++)

     {

          Add instances of subform "x"

     }

}

Thanks

Srini

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Try like this..

Use JavaScript as language..

if(xfa.resolveNode("$record.FundDataArray").value!=null)

{

     for (i=0;I<10;i++)

     {

          Add instances of subform "x"

     }

}

Thanks

Srini

Avatar

Former Community Member

Hi Srini,

I didn't excatly get you what do mean by "Use JavaScript as language". We have been using this kind of script since years.

I have tried using the script you mentioned. Again, it worked on Local machine and failed on FormsServer. I am not able to trace out the exact reason for the same.

Another thing i noticed was, when i add app.alert("hi"); inside the for loop, adding instances doesn't work on local machine too. :-(

Since the documents can't be uploaded here, if you have no issues to share your email id, i can forward the documents to you.

My mail id : kvdvijaykumar@gmail.com

Thanks in advance.

Avatar

Level 10

Vijay,

     I checked your form.. You have not created any data connection in the form. Your code is working in the design time because you will have a preview tab in the form properties where in you can provide the XML file path..For testing at the design time, the form will use this XML file..

But when you are rendering the form using the form server, there is no link/ relationship between xdp and your xml. Once you create a data connection using the same xml at the design time, then at the time of rendering the form will identify the XML passed and you will have access to the tags in the XML..

To create a dataconnection, goto Window -> Data View menu..

Also I observed you have set the form to render as Static in the Default tab of the form properties.. May be you need to change it to Dynamic. Also save the file as Dynamic XML form.

Try these and let me know if you still have issues..

Thanks

Srini

Avatar

Former Community Member

Hi  Srini,

As you told, we have not saved he form as "Dynamic PDF". Instead, we saved it as static PDF. The other issue is we didn't select Language as "Java Script" in the Form Properties window even though we have selected "JavaScript" in script window.

Thanks a lot for your valuable information. :-)