Thanks Srini, that was very useful.
I would like to make my function recursive for when there are nested subforms. Can you tell me how I can get the full path of a subform for feeding back into the function?
Here is the function:
function doesSubformHaveData( strSubformPath )
{
var objSubform = xfa.resolveNode( strSubformPath );
//Loop through the node of this subform and check is 'field' nodes have data.
//Where the node is a subform put it through the same function.
for ( i = 0; i < objSubform.nodes.length; i++ )
{
if ( objSubform.nodes.item(i).className == "field" )
{
//If the node is a field check if it has data
if ( objSubform.nodes.item(i).rawValue != null )
return true; //Some data has been found so return true
}
else if (objSubform.nodes.item(i).className == "subform" )
{
//If the node is a subform put it through the same function
if ( doesSubformHaveData( strSubformPath + "." + objSubform.nodes.item(i).name ) ) //PROBLEM LINE
return true; //Some data has been found so return true
}
}
return false; //No data has been found so return true
}
The line above that I have commented with 'PROBLEM LINE' does not work if the nested subform does not have a title. Is there a way of getting the full path of the subform without having to append the name in this way.
Thanks again,
Kieran