5 Replies Latest reply on Feb 13, 2014 2:49 PM by paulbisr

    Livecycle "reset" button


      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?

        • 1. Re: Livecycle "reset" button
          Magus069 Level 4

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

          • 2. Re: Livecycle "reset" button
            paulbisr Level 1

            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.


            • 3. Re: Livecycle "reset" button
              Magus069 Level 4

              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 :





              [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


              var tabExpression = new Array();



              function getAllFields(rootObject){

                   if (rootObject.nodes.length > 0 && rootObject.className != "field"){

                                 for (var i = 0; i < rootObject.nodes.length; i++){




                   if (rootObject.className == "field" && rootObject.name != "CheckBox3"){

                        tabExpression[tabExpression.length] = rootObject.somExpression;





              function getExpressions(rootObject){


                        return tabExpression;





              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 :

              var tab = myForm.getExpressions(xfa.resolveNode("form1.Main"));

              var strExpressions = "";

              for (var i = 0; i < tab.length; i++){

                   strExpressions += tab[i];

                   if (i + 1 < tab.length){

                        strExpressions += ", ";





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

              Hope it helps!

              • 4. Re: Livecycle "reset" button
                Magus069 Level 4

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



                • 5. Re: Livecycle "reset" button
                  paulbisr Level 1

                  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