Clearing field data when making fields invisible

Avatar

Avatar
Level 4
_Bill_Bain_
Level 4

Likes

0 likes

Total Posts

79 posts

Correct reply

0 solutions
View profile

Avatar
Level 4
_Bill_Bain_
Level 4

Likes

0 likes

Total Posts

79 posts

Correct reply

0 solutions
View profile
_Bill_Bain_
Level 4

04-06-2008

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.



Questions:



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.

Replies

Avatar

Avatar
Level 4
_Bill_Bain_
Level 4

Likes

0 likes

Total Posts

79 posts

Correct reply

0 solutions
View profile

Avatar
Level 4
_Bill_Bain_
Level 4

Likes

0 likes

Total Posts

79 posts

Correct reply

0 solutions
View profile
_Bill_Bain_
Level 4

04-06-2008

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 . . . .

Avatar

Avatar
Level 5
_SekharN_
Level 5

Likes

0 likes

Total Posts

246 posts

Correct reply

0 solutions
View profile

Avatar
Level 5
_SekharN_
Level 5

Likes

0 likes

Total Posts

246 posts

Correct reply

0 solutions
View profile
_SekharN_
Level 5

05-06-2008

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.

Avatar

08-06-2008

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.