Expand my Community achievements bar.

Emptied fields reappear after save.

Avatar

Level 4

Hey everyone,

I've come across a weird behaviour in all of my dynamic .PDF forms. The following describes the conditions that cause the issue that I'm having:

- A user opens one of the 'reader extended' dynamic forms that I've made.

- They fill out the form and save it.

- They delete the contents of one or more of the fields (so that a field that had content in it is now empty), and save it again.

- They close and reopen the form.

Once they have reopened the form, the field(s) that they cleared still has the same content as from before they cleared and saved it.

This behaviour is consistent across all of my 'reader extended' dynamic .PDF forms. What's interesting is that if the contents of the field are changed (not just removed) the changes are saved. It's only the emptied fields that revert to their previous content.

A work around that I've informed my users about is to put a space in the emptied fields. That way, the field value is saved as a space, and the contents do not revert to their previous content.

If I didn't explain something well enough, please let me know. I don't understand why this would be happening. I don't have any formcalc scripts tht modify the contents of fields... I just have some repeatable subforms.

I'd really appreciate some help here.

- Scott

2 Replies

Avatar

Level 7

Hi,

It would appear that null is not considered a "scrip-based state change". Your manual work-around sort of proves that. You could write a script (or a javaScript function in a script object) and place it on the exit event or the preSave event of your fields. The function would add a space (or some message) if the field is null, or    ""  ..

I am interested to see what others know about this. Perhaps this is a reportable bug. Or maybe it is by design.

Stephen

Avatar

Level 4

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