Question Details

avatar
You're on your way! It won't take you many more points to reach the next status level: Contributor. And as you answer other users questions and accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

How do you referance a textbox in an instance of a Subform Set

Hi,

I have a form with the following hierarchy.

form1
-page1
-page2
-sfsDefendants
-page3
-page4
-page5
-affidavit_header
-toolbar
-narrative_flow
-affidavit_trailer

On page1 I have a dynamic table with an add button, textbox, and delete button. I have the form javascript set so it will create an instance of the sfsDefendants which consists of pages3 - 5.

When the users enters a name in the textbox on the table I have the script run on the exit event.

Basically it collects whatever was entered into the instance of the textbox on page1 and populates this info out to the other txtDefendants textboxes on the other pages.

I can get it to populate the first time through for the page5 txtDefendants boxes, but not on the second or more instances. From troubleshooting it looks like it has something to do with the hierarchy since I have other subforms in page5.

Any help is greatly appreciated.

Thanks,


Software Manager 796 days ago


4 Answers

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

For a script that is outside the repeated subform, the field is accessed through the instance number of the repeated subform. To do this you need to learn about the "resolveNode()" function.

Inside the repeated subform its not a problem because the fields can be referenced using relative paths.

I used to have a really great video on this site that explained exactly what it is you need to, but it was lost in the transition to the new format :( However, I do have many more videos that explain everything you need to know in much greater detail, with downloadable examples, at www.pdfscripting.com.


Thom Parker
The source for PDF Scripting Info pdfscripting.com

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work


Thom Parker answered 796 days ago  |   Comments (0)  |  New Comment

avatar

  |   Report
Was this answer helpful?  
0
0

avatar
You're on your way! It won't take you many more points to reach the next status level: Contributor. And as you answer other users questions and accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

Thom,

I was not able to post my script in my origional post, but here it is.

var a = xfa.resolveNode("form1.page1.tblDefendant.Table1.Row1[" + this.parent.index + "]").txtDefendant.rawValue;

xfa.resolveNode("form1.sfsDefendants.page3[" + this.parent.index + "]").txtDefendant.rawValue = a;

xfa.resolveNode("form1.sfsDefendants.page4[" + this.parent.index + "]").txtDefendant.rawValue = a;

xfa.resolveNode("form1.sfsDefendants.page5.affidavit_header[" + this.parent.index + "]").txtDefendant.rawValue = a;

xfa.resolveNode("form1.sfsDefendants.page5.affidavit_trailer[" + this.parent.index + "]").txtDefendant.rawValue = a;

As you mentioned I should use the resolveNode command, which I am. When I enter data in the textbox on page1, it populates out to all of the page3 and page4 instances, but only to the first instance of page5. I will also review the website you posted for a reference.

Thanks,

Steve


Software Manager answered 796 days ago  |   Comments (0)  |  New Comment

avatar

  |   Report
Was this answer helpful?  
0
0

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

So "affidavit_header" is the repeated subform? And there are exactly the same number of this subform as there are of the "sfsDefendants" subforms? You're also missing the DOM part of the path, i.e., "xfa.form.form1". Where "form" indicates the form model.

Your best bet for figuring this out is to debug your last line of code, the code for page 5, in the JavaScript Console. To do this you'll need to run the form the Acrobat, not the preview window in Designer.


xfa.form.resolveNode("form1.sfsDefendants.page5.affidavit_trailer[0]").txtDefen
dant.rawValue;


Instead of using "this.parent.index", use hard coded numeric values. And don't include the assignment value. Find out where it breaks down. Start out by running smaller segments, making sure each one returns an [object xfaObject] value in the console window. For example:

xfa.form.resolveNode("form1.sfsDefendants.page5.affidavit_trailer[0]")

Just as a point of programming style, the path for executing resolveNode can start at the first ancestor (parent) node that is in common with the target and source nodes.



Thom Parker answered 795 days ago  |   Comments (0)  |  New Comment

avatar

  |   Report
Was this answer helpful?  
0
0

avatar
You're on your way! It won't take you many more points to reach the next status level: Contributor. And as you answer other users questions and accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

Thom,

I played around some more with the code andfound that the following code worked.

xfa.resolveNode("form1.sfsDefendants.page3["+this.parent.index + "]").txtDefendant.rawValue = a;

xfa.resolveNode("form1.sfsDefendants.page4["+this.parent.index + "]").txtDefendant.rawValue = a;

xfa.resolveNode("form1.sfsDefendants.page5["+this.parent.index + "]").affidavit_header.txtDefendant.rawValue = a;

xfa.resolveNode("form1.sfsDefendants.page5["+ this.parent.index + "]").affidavit_trailer.txtDefendant.rawValue = a;


Software Manager answered 791 days ago  |   Comments (0)  |  New Comment

avatar

  |   Report
Was this answer helpful?  
0
0


Download
Acrobat XI trial

Get the trial now


Other Questions Needing Answers