2 Replies Latest reply on Jul 29, 2011 9:55 AM by ginnyX

    Hiding subforms when clearing form?

    ginnyX Level 1

      I am using radio buttons with a switch statement. Depending on which button you check, a subform will either change it's presence from visible to hidden or vice-versa. This is working great. I am running into problems, however, when I go to Forms->Clear Form when using the form in Acrobat. It clears all data entered, and check-marks, but the visible subforms stay visible. I want them to be hidden again when I clear the form.

       

      I have tried to add in another switch statement as follows:

       

      switch(this.rawValue) {

       

          case "NULL":
              NewHire.presence = "hidden";
              Transfer.presence = "hidden";
              Termination.presence = "hidden";
              Add.presence = "hidden";
              Remove.presence = "hidden";
              break;
      }

       

      However, it doesn't seem to be working. Any help? How can I hide the subforms when I clear the form?

        • 1. Re: Hiding subforms when clearing form?
          pguerett Level 6

          When the RadioButtonList is not checked the value is "" not a null so you shoudl be checking for an empty string "". Also which event and which object is the code with the switch statement on? Are you sure that event is firing when you reset the data?

           

          Paul

          1 person found this helpful
          • 2. Re: Hiding subforms when clearing form?
            ginnyX Level 1

            That's definitely helpful. I wasn't sure what the default value was, so I was assuming it was NULL, though I also experiemented with zero.

             

            Let's see, I tried to put the script on the change object, and form:ready object, and layout:ready. I also thought maybe it would be better to go with an if statement, rather than a switch statement since there's only one variation?

             

            If so, I was thinking this:

            if (this.rawValue = "")
                    NewHire.presence = "hidden"
                    Transfer.presence = "hidden"
                    Termination.presence = "hidden"
                    Add.presence = "hidden"
                    Remove.presence = "hidden"
                    else

            end if;

             

            Now I guess I just need to figure out where to put it? Or do I need to somehow add something else to make it do this?