2 Replies Latest reply on Mar 23, 2011 7:18 AM by Jerime CK

    Toggle button for visibility.

    Jerime CK

      Hi, I've seen some info on this on these forums and from Google searches but I'm still a bit confused.  I want to make one button that toggles the visibility for print of one column of fields.  I can do two buttons for this but the a toggle would be much nicer.

       

      Thanks!

        • 1. Re: Toggle button for visibility.
          George_Johnson MVP & Adobe Community Professional

          Suppose there are three fields in the column, "text1", "text2", and "text3". A simple script to toggle their visibility that you can use in the Mouse Up event of the button is:

           

          // MouseUp script for button
          (function () {
          
              // Get a reference to the first field in the column
              var f1 = getField("text1");
          
              // Toggle the display visibility value
              dv = (f1.display === display.visible) ? display.hidden : display.visible;
          
              // Set the display property of the fields to the new value
              f1.display = dv;
              getField("text2").display = dv;
              getField("text3").display = dv;
          
          })();
          

           

          This could be simplified a bit, but you should get the idea.

          • 2. Re: Toggle button for visibility.
            Jerime CK Level 1

            Thanks!  I think I was mainly confused on the syntax.