These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

repeating subform problem

otto_csm
Registered: Jun 17 2009
Posts: 3

Hello!

I have a repeating subform.
Inside that subform i have a drop-down list. At the change event of the drop-down list i have a switch-case that change the value of some text fields.

this is the code:

switch (xfa.event.newText)
{
case "1/3A4":
var y = body.index; //body is my repeating subform

var coloana1 = "form1.FormularComanda.body["+y+"].Produs.DetaliiProdus.Table6.Row2.FormatFinit_lat";
var coloana2 = "form1.FormularComanda.body["+y+"].Produs.DetaliiProdus.Table6.Row2.FormatFinit_lung";
xfa.resolveNode(coloana1).rawValue = "99";
xfa.resolveNode(coloana2).rawValue = "210";
break;

case...
...
}

my problem is that the code doesn't work. I want to change the textfiled's value in the current subform ...not in all the repeating subforms.

I also put instead body.index ..body.instanceindex ,but doesn't work.

Sorry for my bad english.
Thank's!

My Product Information:
Acrobat Pro Extended 9.0, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Let me see if I have this straight. You want to use a DropDown field in a subform to modify a field in the same subform? Is this correct?

So there are two very different issues with your code. First, and most important. Since both fields are in the same subform they can be access directly using a relative path. Like this:

Produs.DetaliiProdus.Table6.Row2.FormatFinit_lat.rawValue = "99";

You don't need build an absolute path and perform a resolveNode. Fields in the same subform are directly accessible to one another. This is the main advantage of XML forms.

Next, and this is just for your information. When you reference a repeated parent node by it's name Acrobat automatically resolves that node to it's first instance. So the line

var y = body.index;

references the first instance of the body subform. If you need the current subform index you can access it directly by walking up the node tree. So, if body is the immediate parent you can use:

var y = this.parent.index;

Please watch this video:
https://admin.adobe.acrobat.com/_a200985228/p87746471/

You'll also find much more detailed videos and sample files on this exact topic at:
www.pdfscripting.com

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

otto_csm
Registered: Jun 17 2009
Posts: 3
Thank's for your reply.
It work's now.

Also thank's for the tutorials.