Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Clearing fields in a dynamtic form

Avatar

Former Community Member
I am a newbie to LiveCycle and a really appreciate the postings from everyone. I created a form that connects to an external MS Access database and am using navigation buttons to move through the records in the database. About half of the fields that I am populating on the form come from the database and the other half come from the user. The user fields are date/time and some text fields. The issue I am having is that if I enter any data into a user field (for example the date field) and move to the next record, the data from the first record is carried over. Any way to clear the manual entry fields when a user navigates to the next record? Thanks
3 Replies

Avatar

Former Community Member
The issue is that there are no bindings (info coming from the DB) for that field. So you will have to clear those fields yourself. On the button that gets the next record add code to clear the fields before you ask for the next record. Conversely you can try to do an xfa.host.resetData(). This will reset th eform back to its original state. This may also cause your connection to the DB to be reset as well. Try it and see.

Avatar

Former Community Member
Thanks for the suggestion. I tried to add the reset function bu I lost the connection to datasource. Do you have the code I can add to the button to clear the fields. Here is what I have so far:<br /><br /> <?templateDesigner expand 1?><br /> <ui><br /> <button/><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <caption><br /> <value><br /> <text>Next &gt;</text><br /> </value><br /> <para hAlign="center" vAlign="middle"/><br /> <font typeface="Myriad Pro"/><br /> </caption><br /> <border hand="right"><br /> <edge stroke="raised"/><br /> <fill><br /> <color value="212,208,200"/><br /> </fill><br /> </border><br /> <bind match="none"/><br /> <event activity="click"><br /> <script>// Database navigation button &gt;&gt; go to the next record.<br /><br />// Changing records implies updating the current record with any changes. Enabling this statement would ensure that no changes are committed<br />// without the user explicitly using the Update button.<br />//xfa.sourceSet.DataConnection.cancel()<br /><br />xfa.sourceSet.DataConnection.next()</script><br /> </event><br /> </field><br /> <field h="7.62mm" name="dbLast" relevant="-print" w="25.4mm" x="212.7249mm" y="0.0001mm"><br /> <ui><br /> <button/><br /> </ui><br /> <font typeface="Myriad Pro"/><br /> <caption><br /> <value><br /> <text>Last &gt;&gt;</text><br /> </value><br /> <para hAlign="center" vAlign="middle"/><br /> <font typeface="Myriad Pro"/><br /> </caption><br /> <border hand="right"><br /> <edge stroke="raised"/><br /> <fill><br /> <color value="212,208,200"/><br /> </fill><br /> </border><br /> <bind match="none"/><br /> <event activity="click"><br /> <script>// Database navigation button &gt;&gt; go to the last record.<br /><br />// Changing records implies updating the current record with any changes. Enabling this statement would ensure that no changes are committed<br />// without the user explicitly using the Update button.<br />//xfa.sourceSet.DataConnection.cancel()<br /><br />xfa.sourceSet.DataConnection.last()</script><br /> </event>

Avatar

Former Community Member
You would simply add the code:



Fieldname.rawValue = "";



Repeat for each field you want to clear.