11 Replies Latest reply on Jan 13, 2011 11:09 AM by gkaiseril

    Check box problem

    aCmE111

      Hello,

       

      I would like to create few checkboxes, each of them should make certain text box visible and other text boxes, that might been already unhidden, unvisible.

       

      I have achieved it basically, problem that has occured is that checkbox makes text box appear every time you click it, no matter if you're checking or unchecking it.

       

      And i would like to make certain things appear only when checking the check box. Looking for some advice. I'm using Acrobat 9 Standard.

       

      Thanks.

        • 1. Re: Check box problem
          try67 MVP & Adobe Community Professional

          Do you look at the value of the event in your code? Maybe you should post

          it, so we can see what you're doing wrong.

          • 2. Re: Check box problem
            George_Johnson MVP & Adobe Community Professional

            In the Mouse Up event of a check box, you could do something like:

             

            (function () {

             

                var f1 = getField("text1");

                var f2 = getField("text2")

                // Add other fields here as needed

             

                // If this check box is unchecked...

                if (event.target.value === "Off") {

                    // Show/hide fields here

                    f1.display = display.visible;

                    f2.display = display.hidden;

             

                } else {  // Check box is selected

             

                    // Hide/show fields here

                    f1.display = display.hidden;

                    f2.display = display.visible;

                }

             

            })();

             

             

            You should also probably reset the field values as well, but that's up to you.      

            1 person found this helpful
            • 3. Re: Check box problem
              aCmE111 Level 1

              Thanks for advice guys. But apparently it's not possible or I don't know how to edit code in this Acrobat. Maybe it's only possible in Pro version ?

              • 4. Re: Check box problem
                try67 MVP & Adobe Community Professional

                Do you have Acrobat or Reader? If Reader, then no, you can't do it. If

                Acrobat, then you can (all versions of Acroabt are capable of doing it).

                • 5. Re: Check box problem
                  aCmE111 Level 1

                  Adobe Acrobat 9 Standard.

                  • 6. Re: Check box problem
                    aCmE111 Level 1

                    Ok I've found JavaScript Editor, we are making progress

                    • 7. Re: Check box problem
                      try67 MVP & Adobe Community Professional

                      Select the Object Selection tool (a black arrow), right-click the check-box,

                      select Properties and then go to the Action tab and add George's script as

                      the MouseUp event.

                      1 person found this helpful
                      • 8. Re: Check box problem
                        aCmE111 Level 1

                        It works thanks

                        • 9. Re: Check box problem
                          aCmE111 Level 1

                          Now i have to figure out how does this conditional functions work with other fields like for example radio buttons.

                           

                          I want to create form that will unfold based on user choices and change of very top field should make all previously unhidden fields hide again and new process to begin.

                           

                          Will try, eventually will make all of the options visible straight away if i won't make it.

                          • 10. Re: Check box problem
                            aCmE111 Level 1

                            Problem that I've encountered with radio buttons is that they are in groups under the same name. Just need to separately assign commands to them.

                            • 11. Re: Check box problem
                              gkaiseril MVP & Adobe Community Professional

                              Radio buttons and check boxes with the same name are called 'exclusionary groups' and if one of the members, widget, is checked then all the other members of the group are unchecked. The 'export value' for the widget determines which individual member field is checked, so one needs to provide a unique export value for each field. Also, if no member of the group is checked the value for the groups is 'Off' and the value of the group of field for a checked item is the export value of the selected widget. This technique allows an automated (scripting) sequence to determine which item has been selected and can also allow the automated code to check an individual item.

                               

                              You might want to look at the Acrobat JS API Reference for more information about form field properties and methods.