Reading ALL form fields in an ACRO form

Reading ALL form fields in an ACRO form

Forum member · Jun 17, 2008
The recursive call does not work in ASP.NET 2.0 using the trial version of the software. I used this sample code on a web form where I am creating a generic string list to return from a method to feed a gridview. Here is the main method I call: private List<string> CreateList(ceTe.DynamicPDF.Merger.Forms.PdfFormFieldList fieldList) { List<string> alist = new List<string>(); for( int i = 0; i < fieldList.Count; i++ ) { alist.Add("Field:" + fieldList[i].FullName ); alist.Add("Value: " + fieldList[i].GetValue() ); if( fieldList[i].HasChildFields == true ) { CreateList(fieldList[i].ChildFields ); } alist.Add("Type: " + GetFieldType(fieldList[i])); } return alist; } Unfortunately, it only returns my top most item which is a container without any of the child fields. This is probably a "DOH!" but I don't see why this is not working. Is there a different way I should get all the childfields in an ACRO form?

Re: Reading ALL form fields in an ACRO form

Support · Jun 18, 2008
Hello, You are creating the generic list every time when you call the method CreateList. This clears the list which has the fields and creates new list item when calling recursively for the child fields. This is the problem for not returning all the fields. You will have to create the list item globally so that you can just add the items to it in the for loop. Following is the code. //Declare globally. List<string> alist = new List<string>(); ------- ------- //You should not create a new list in this method. private List<string> CreateList(ceTe.DynamicPDF.Merger.Forms.PdfFormFieldList fieldList) { for( int i = 0; i < fieldList.Count; i++ ) { alist.Add("Field:" + fieldList[i].FullName ); alist.Add("Value: " + fieldList[i].GetValue() ); if( fieldList[i].HasChildFields == true ) { CreateList(fieldList[i].ChildFields ); } alist.Add("Type: " + GetFieldType(fieldList[i])); } return alist; } Thanks, ceTe Software Support Team.

Re: Reading ALL form fields in an ACRO form

Forum member · Jun 18, 2008
I thought it might be a "DOH!" kinda question. Thanks, that did the trick.