AI OnAI Off
Hi Paul,
If the TextBlock have nested ContentArea property where FormBlocks could be stored, then try to used this property and call GetAllFieldsMethod recursively:
private List<KeyValuePair<string, string>> GetAllFields(ContentArea contentArea) { var rtn = new List<KeyValuePair<string, string>>(); foreach (var item in contentArea.FilteredItems) { var content = item.GetContent(); var textBlock = content as TextBlock; if (textBlock != null) { rtn.AddRange(GetAllFields(textBlock.ContentAreaProperty)); continute; } var formItem = content as IFormItem; if (formItem != null) rtn.AddRange(formItem.GetFieldValues(0)); } return rtn; }
Hi
i have form blocks added into a content area and i use the follwoing code to loop through each form item and retrieve the values. This works great!
private
List<>>
string
,
string
>> GetAllFields(ContentArea contentArea)
{
var rtn =
new
List<>>
string
,
string
>>();
foreach
(var item
in
contentArea.FilteredItems)
{
var formItem = item.GetContent()
as
IFormItem;
if
(formItem !=
null
)
rtn.AddRange(formItem.GetFieldValues(0));
}
return
rtn;
}
however, i also have a text block inside the same content area which contains form blocks too. How can i retrieve the the field values of the form blocks nested inside the text block?
structure
form block
form block
form block
Text block
form block
form block
form block
Any pointers will be greatly received
Paul