1 Reply Latest reply on Dec 7, 2011 12:53 PM by radzmar

    Hidden drop-down list

    sp215 Level 1

      Hi,

       

      I have a form with multiple drop-down, text fields, etc. Depending on how the user responds to drop downs, but what I would like to do is for users to be able to part complete the form, save it and when it reopens to prompt them with the part completed form and a new question automatically opens, but this question would only open after the form had been saved for the first time.

       

      A bit confusing I know :-)

        • 1. Re: Hidden drop-down list
          radzmar Adobe Community Professional & MVP

          Hi,

           

          I made a sample for you.

          It has 3 scripts to create and check a counter for how many time the form has been saved.

          If it was only saved once, it shows a message box.

           

          https://acrobat.com/#d=xEOrpXZ5VRywi2W8eRVsgA

           

          The first script is in a script object "Actions". It creates the counter.

          function initSaveCounter(targetObject) {

              if (targetObject.extras.nodes.namedItem("SaveCounter") === null) {

                  targetObject.extras.nodes.append(xfa.form.createNode("extras", "SaveCounter"));

                  targetObject.extras.SaveCounter.nodes.append(xfa.form.createNode("integer", "state"));

                  while (targetObject.extras.SaveCounter.nodes.length > 0) {

                      targetObject.extras.SaveCounter.nodes.remove(targetObject.extras.SaveCounter.nodes.item(t argetObject.extras.SaveCounter.nodes.length - 1));

                  }

                  var newState = xfa.form.createNode("integer", "SaveCounter");

                  newState.value = 0;

                  targetObject.extras.SaveCounter.nodes.append(newState);

              }

          }

           

          The second script is in the formReady:Event. It checks if the current count or creates a counter in none exists.

          var saveCount;

           

          if (this.extras.nodes.namedItem("SaveCounter") == null) {

                    Actions.initSaveCounter(this);

          } else {

                    saveCount = this.extras.SaveCounter.nodes.item(0).value;

                    if (saveCount == 1) {

                              xfa.host.messageBox("Form is not finished")

                    }

          }

           

          The third script is in the preSave:Event of the root node "Formular1/form1".

          It increases the counter every time the form is saved.

          this.extras.SaveCounter.nodes.item(0).value = this.extras.SaveCounter.nodes.item(0).value + 1;