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.

Livecycle "reset" button

Avatar

Former Community Member

Does anyone know how I can exlude one of the fields on my form from being cleared when someone uses the 'reset button?  I'm okay with all the fields clearing exept for one of them?

5 Replies

Avatar

Level 10

I think you have to write xfa.host.resetData(Here enter all the somExpression you want to reset, using "," as separator);

Avatar

Former Community Member

Thank you for your response.  Forgive my lack of knowledge, but what is somExpression?  It sounds like you are saying that I would have to list all the fields I want to be reset.  I have roughly 500 fields, so it would be better if there was some way to have the button reset all but one of them.  is there a way that you know of to write the script to exclude one field?  I hope that makes sense.

Thanks

Avatar

Level 10

somExpression is the path starting from the first object of your form e.g.

Your form is called form1 by default and it contains master pages and pages

Page1 contains a 3 subform with each respectively 1 textbox inside it

your textboxes somExpression would be like so :

form1[0].Page1[0].Subform1[0].TextField1[0]

form1[0].Page1[0].Subform2[0].TextField2[0]

form1[0].Page1[0].Subform3[0].TextField3[0]

[0] represents how many instances of the same object name is inside the node.

So now, thanks for asking this question because I always wanted to have one method to get everything done easily

So I made a small method which will retrieve the somExpression of all your fields in your form and will create a table of string containing each somExpression

1. You must create a scriptObject and name it myForm

2. Paste this code inside the script object

3. Where you see CheckBox3... that is the field you don't want to reset its value and you can add as many fields as you want if the if statement

4. Now in your button click_event paste this down :

"Main" is the name of your Page containing all the objects

Hope it helps!

Avatar

Level 10

Also I've just found this, it would probably be more convenient for only one field...

http://forums.adobe.com/thread/1030397

Avatar

Former Community Member

Thank you!  This seems to work, per the other discussion thread.  All fields are clearing except the one I entered in the script.

Thanks again