Alright, I've done some extensive testing, and I've found out the precise cause of this behavior. It doesn't occur on all fields, just the ones that are set to accept rich text.
I've taken a peek at the XML behind the fields as their values are edited. All text fields start with just the following:
<?xml version="1.0" encoding="UTF-8"?>
once the value has been edited then cleared, the XML becomes:
<?xml version="1.0" encoding="UTF-8"?>
<value override="1" xmlns="http://www.xfa.org/schema/xfa-template/3.0/">
<exData contentType="text/plain"/>
</value>
I think that this left over artifact causes livecycle to revert to some internally sotred exData value, and that the only way to overwrite it is to change the content, forcing the new data to be stored in the internal exData.
I've tried using:
.value.loadXML('<?xml version="1.0" encoding="UTF-8"?>',0,1);
... I was hoping that this would overwrite the value back to null, but it didn't work. So far, the best that I've come up with is this (in the preSave code):
for (var nPageCount = 0; nPageCount < xfa.host.numPages; nPageCount++)
{
var oFields = xfa.layout.pageContent(nPageCount, "field");
var nNodesLength = oFields.length;
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++)
{
if (oFields.item(nNodeCount).rawValue == null || oFields.item(nNodeCount).rawValue.length == 0 || oFields.item(nNodeCount).rawValue == "")
{
oFields.item(nNodeCount).rawValue = " ";
}
}
}
This checks all fields to see if it's empty, if it is, it enters a space into the field. I would like to further refine this code to only update those fields that are set to accept rich text, but I can't see any attribute where that is stored. 'getAttribute' might be what I'm looking for, but without knowing the name of the attribute, I'm lost.
I would also like to find some other way (besides putting in a space) to fix the issue. I hate that all my empty fields have to have a space in them.
I would appreciate it if anyone knew a solution the the two issues posted above.. Also, is this a bug? Should I report this, and if so, where do I go to report it?
Thanks for any help you might be able to offer,
- Scott