Expand my Community achievements bar.

July 31st AEM Gems Webinar: Elevate your AEM development to master the integration of private GitHub repositories within AEM Cloud Manager.

Clearing field data when making fields invisible


Level 4
I have a form that if users select certain check boxes, some fields are made invisible. One issue has arisen in that if a user fills in a visible field that is later made invisible because, for example, the user changed his mind on the triggering checkbox, the XML data file still contains the data from the formerly visible field.


1. Is there a method to clear individual field data?

2. If I made the field hidden instead of visible would that impact this issue? I'm still not clear on the distinction between "invisible" and "hidden."

Lastly -- is there a reference for the actual syntax of the various methods and properties used in Designer? I've looked on the Web, but a lot of the references on JavaScript syntax seem to leave out items like the curly braces and the semi-colon from their examples, which makes using them an "adventure." Thanks in advance.
3 Replies


Level 4
I found the response to my first question after some digging: clearing individual fields is through the xfa.host.reset.Data() method where the parameter inside the parentheses is "fieldname1, fieldname2" etc.

Still seeking a response to the question about the difference between "hidden" and "invisible", though . . . .


Level 5
Hidden and invisible both related to UI Layout.

"invisible" just makes the object non visible, object still occupy layout space.

"Hidden" makes object do not occupy any layout space.

In both cases rest of the properties are still accessible and will have same values.


Former Community Member
Bill, you could clear the field values with this JavaScript:

TextField1.rawValue = ""; or this.rawValue = "";

You also could use this in an if statement indicating when the field's presence is hidden or invisible, clear the field.

This would remove the data, and should not transfer to a connected database.