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

Finding a form object without using its name

devospice
Registered: May 11 2009
Posts: 6

Is there a way to find a form object without using its name?

The problem is the form is being processed using a third party site (CreateSurvey.com). In order for it to work there the check boxes for a question all have to have the same name. (They have different IDs in the HTML, but I don't see a way to assign an ID in Acrobat.)

In order to get my code to work (which deselects A, B, or C if the user clicks D, and vice versa) I had to rename the check boxes so they had different names. This will break the form at CreateSurvey. However, if all four check boxes have the same name there's no way for me to access them using JavaScript in Acrobat.

What I'm hoping is that there's some other way to identify a check box other than this.getField("fieldname") that will work.

Here's my code. Suggestions welcome.

function clickedBox3ABorC()
{
var d_box;

d_box = this.getField("c.37_4");

if (d_box.value == "4") {
d_box.value = "Off";
}
}

function clickedBox3D()
{

var a_box;
var b_box;
var c_box;
var d_box;

a_box = this.getField("c.37_1");
b_box = this.getField("c.37_2");
c_box = this.getField("c.37_3");
d_box = this.getField("c.37_4");

//console.println(a_box.value);

//console.println(event.target.value);

if (d_box.value == "4") {
a_box.value = "Off";
b_box.value = "Off";
c_box.value = "Off";
}

}

Thanks!

->Later.....Spice

My Product Information:
Acrobat Pro 8.0, Windows
try67
Expert
Registered: Oct 30 2008
Posts: 2399
Then based on what do you want to identify these fields?

- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com

devospice
Registered: May 11 2009
Posts: 6
Node? ID? I was hoping there was some other internal way of identifying the fields that I could tap into. However I finally found the JavaScript documentation for Acrobat and have been reading through it. I don't see any other way to access fields. I also read that fields with the same name have the same value, which will probably screw up the form submission anyway.

Right now I'm looking to contact the form processing company and seeing if there's a way I can change the names of the form fields on their end to match the PDF.
devospice
Registered: May 11 2009
Posts: 6
In JavaScript on a web page you can do this:

var box1 = elements['c.8'][0];
var box2 = elements['c.8'][1];
var box3 = elements['c.8'][2];

to get different items on the page that all have the same name. Is there a way to do that in Acrobat? The above code doesn't work.

->Later.....Spice