I have a form to create generic documents (like product specifications, assembly procedures, etc.) that essentially allows a user to add images or text in any order to fit his needs for that particular document.
The user adds content as needed, which by default adds both a subform with both an image field subform and a text field subform and the user can choose to delete either (or both) and/or add more content.
Everything works fine, but when the completed form is submitted (whether it be xml or pdf) all the deleted subforms reappear in the received document. Is there something small that I'm missing here or is just not possible to delete subforms at the host and have them stay gone through the form submission process? Thanks so much for any help/advice!
In Acrobat 9 you also have the option of having Acrobat automatically restore the visual state of a dynamic form. This is on the default tab in the document properties dialog.
Originally in LiveCycle only the data was saved with the form. If there were graphical changes made on the form, like showing or hiding a field, these were lost. You had to write specical code to restore the visual state of the form based on the saved data. This is actually a core concept behind the LiveCycle model, i.e., data drives the configuration of the form. If there's no automatic, or built-in, connection between the data and the visual state of the from you have to have special code that makes this connection.
Unfortuantely a lot of people didn't get this and so Adobe added the feature to Automatically save and restore the visible state of the form along with the data.
Now, in your case I suspect you don't have this option checked, or you are using an older version. Without anthing else driving it Acrobat is simply displaying the original state of the form, as defined in the template model. In the case where there data only is being submitted the form may not restore correctly even with this option checked because, well, how would it know? The visual state data would have to be included in the data, which is might if the submitted data is XMP, but no other format could provide this info.
You would be better off redesigning your form with two changes. First, don't destroy the subforms, Just set the presence to hidden. Second, start off with the subforms hidden and use code on a checkbox to unhide them. In fact, include an Initialize event for the subform that shows or hides itself based on the state of the check box. This will solve your problem.
Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]
The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]
Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script