1 Reply Latest reply on Feb 27, 2009 2:49 PM by Raghu Nagireddy

    Unable to make subform invisible/visible

      Heya guys;

      I'm trying to create a form which enables/disables sections that need to be filled out depending on the status of a checkbox. For example if somebody ticks the checkbox to request internet they need to fill out a section to make the request, and I would like to make that request only visible/enabled if the user has that box checked. If the box is not checked I would like the form invisible/disabled.

      I'm pretty new to using Adobe scripting and its been a while since I programmed so I am digging up Javascript I used 8 years ago. These are static forms as I do not yet know how to create forms that dynamically add or remove objects depending on user inputs.

      One more point, it seems my code works if I point the code at ANY other type of object. Subforms do seem to accept the change in the presence value, but it has no visible effect on the object. To debuf I placed messageboxes throught my code at different points so that I can see what is being executed and what values certin key variables have. It is properly executing and moving through the IF statement, and the value of the presence attribute is changing for the subform. However changing the value from visible to invisible doesn't hide the subform and the objects within it.

      please note....
      the main forms are "p1" and "p2"
      the main project is called "rqa"
      the name of the checkbox toggle is "chkinternet"
      the name of the subform to change presence state is "frmS3" and it is within form "p2"

      ----- rqa.p1.applications.chkInternet::click - (JavaScript, client) --------------------------------

      xfa.host.messageBox("The Checkbox is set to: " + this.rawValue); //DEBUG: what is value of the current checkbox
      xfa.host.messageBox("Current form value: " + rqa.p2.frmS3.getAttribute("presence")); //DEBUG: What is the value of the target subform's presence attribute
      if (this.rawValue == true) //check condition to see if box is checked, if checked make subform visible
      {
      xfa.host.messageBox("true"); //DEBUG: Determines weather if statement was successful and "true" condition code is being executed
      rqa.p2.frmS3.presence = "visible"; //makes subform visible
      }
      else //in the instance the box is not checked
      {
      xfa.host.messageBox("false"); //DEBUG: Determines weather if staement was successful and "false" condition is being executed
      rqa.p2.frmS3.presence = "invisible"; //makes subform invisible
      }
      xfa.host.messageBox("end sub"); //DEBUG: Checks to make sure all of the code was executed in control
        • 1. Re: Unable to make subform invisible/visible
          Raghu Nagireddy Level 3
          Hello,

          First make the subform HIDDEN.
          When check box value is true make the subform presence visible,
          that means rest of the time automatically invisible no need to do code extra for this.

          on checkbox click event only write this code
          app.alert(this.rawValue) //check which value ur getting
          if (this.rawValue == "true")
          {
          rqa.p2.frmS3.presence = "visible";//ROOTDocument.PAGE.SUBFORMName.presence = "visible";
          }