5 Replies Latest reply on Mar 14, 2013 8:25 AM by Steve Bishop

    Disable/Enable Subform

    kjensen4 Level 1

      I have a subform in my form that I would like to have as disabled or protected until the very end of the form.  It has 2 signature fields and 2 submit buttons at the end.  After the 2nd submit button is used I'd like the reciever of the form to have access to the disabled subform.  How do I do that?  I've tried setting it to "open" but it will do it on my screen after I submit, but not in the attachment.

       

      Thanks for the help.

        • 1. Re: Disable/Enable Subform
          Steve Bishop Level 2

          I don't follow everything you said, but you have to disable individual subform elements.

           

          function setReadOnly(myParentObject){

              var allChildElements;

              var intNumElements;

              var currentElement;

              var j;

             

              //Get all the child nodes of the parent element

              allChildElements = myParentObject.nodes;

           

           

              //Total number of element in the object

              intNumElements = allChildElements.length;

           

           

              //Loop through all the child elements

              for(j = 0; j < intNumElements; j++){

                  currentElement = allChildElements.item(j);

           

           

                  //If the element is another subform we'll recusively call the function again

                  if(allChildElements.item(j).className == "subform") {

                      setReadOnly(currentElement);

                  } //If the objects are fields or exclusive groups then we'll check them, null or not

                  else if(currentElement.className == "field" || currentElement.className == "exclGroup") {

                            var eUI = currentElement.ui;

                            //app.alert(eUI.textEdit);

                            try {

                                if((eUI != null && eUI.button == null) || currentElement.className == "exclGroup") {

                                    currentElement.access = "readOnly";                         

                                }

                            } catch (e) {

                                      app.alert(e);

                            }

                  }

              }  

          }//end function

          • 2. Re: Disable/Enable Subform
            kjensen4 Level 1

            I don't totally follow what you're saying because I don't know where exactly to put the scripts.  A link to the form is below.  What I'm trying to do is have the the Dept Use Only Box with all it's fields appear on the screen, but as protected or read only and then become active after the Supervisor has signed the form and submitted it to the business center.  Right now I've done various things where I can get things to activate after the signature, but it doesn't stay enabled after the form has been emailed.  It's the business center that needs to use that box.  Any ideas?  Thanks!

             

            https://workspaces.acrobat.com/?d=aFwy-1B5GKsP7WZ*r57P7g

            • 3. Re: Disable/Enable Subform
              Steve Bishop Level 2

              I don't have an ID and am not going to create one to open the file.

               

              What is this setting: File > Form Properties > Defaults tab > Preserve scripting changes to form when saved? If manual, try automatic. If already automatic, in what event are you setting the access to open.

              • 4. Re: Disable/Enable Subform
                kjensen4 Level 1

                Everything was set open from what I could see.  I was trying to set it to open up either when a signature field was completed or else when a submit button is clicked and the form is sent to someone else.  When I try to put it on the button, my copy of the form seems to have the fields unlocked, but the person receiving the form does not.  That's why I thought I'd try it on the signature field.

                • 5. Re: Disable/Enable Subform
                  Steve Bishop Level 2

                  What is this setting: File > Form Properties > Defaults tab > Preserve scripting changes to form when saved? If manual, try automatic. If already automatic, in what event are you setting the access to open.

                   

                  You can also put script in the initialize event to lock the fields based on some value in the form. For example, you can create a hidden form field called locked and set it to true when the submit button is clicked. In the initialize event, lock all the fields if the locked check box is checked.