Forum Discussion

aBello's avatar
aBello
New Contributor
9 years ago

AcroForm example in TestComplete

Hi all,

 

does anyone have a good example accessing the fields in an AcroForm in TestComplete?  I have a function below that appears to be getting the fields in the form based on the log messages, but I am having trouble figuring out how to access the individual fields.  I read the getFields() method returns a list.  Does that mean I have to convert this list to an array to access the individual entries?  Any help or pointing in the right direction would be greatly apprecieated.

 

Thanks,

Alfredo

 

function getDocument()
{
var docObj;

docObj = loadDocument("DischargeAdobe_July-2015RE.PDF");

// Get the catalog object
catalog = docObj.getDocumentCatalog();

var form = catalog.getAcroForm();

if (form == null)
Log["Message"]("Acroform command failed");
else
{
Log["Message"]("Success getting Acroform");
var fields = form.getFields();

if (fields == null)
Log["Message"]("Fields are null");
else
{
Log["Message"]("Fields have values: " + fields["length"]);
for (var i=0;i<fields["length"];i++)
{
Log["Message"](fields[i]);
}

}
}
}

No RepliesBe the first to reply