4 Replies Latest reply on Aug 6, 2011 10:39 PM by MikeABca

    script to check a radio button

    MikeABca

      Hi

      I have made a form with a number of radio button groups (100).  Each group has 3 choices.  Pass/Fail/NA.  It is a check list that has to be printed after each inspection of the work is done.  It is reinspected each time until all points pass.  I would like to have a quick fill box that would check all the radio button as pass to speed up the last entry into the computer.

       

      I have a button set up that when pressed it is to set all radio groups to 'pass'

      I thought I could just use this script for each button, but it does not seem to work

       

       

       

      var setOn = getField('Radio1');

      setOn.setExportValues(0) = 'On';

       

       

      I have been reading through the archive here and trying to find info in the acrobat/java guide but so far I am out to lunch

       

        • 1. Re: script to check a radio button
          gkaiseril MVP & Adobe Community Professional

          Have you tried to write a script to only turn a single button to one of the valid values?

           

          Once you can adjust one, then it is just a matter of making the field name a variable and changing the field name in a controlled manner like reading the field names from an array and setting the value of that radio button or check box to the value of the widget you want selected or "off" for no selection.

           

          You want to set the 'value' property of the exclusionary group and not the 'setExportValues' of a widget within the exclusionary group.

           

          You use the 'setExportValues' when creating the radio buttons or check boxes and setting the export value for each widget within the group.

           

          • 2. Re: script to check a radio button
            MikeABca Level 1

            Sorry for the misunderstanding.  That is basically what I am after.  I sent the section of code where I am trying to set one of the check boxes.  Then I will simply run a loop to set them all.  What I can't figure out is how to access the widget to set it to 'Yes' and get the check mark to show up.  I forgot about the value and changed my script but I think I am still not accessing the widget (first radiobutton in the set)

             

            var setOn = getField('Radio1');

            setOn.value = 'On';

            • 3. Re: script to check a radio button
              gkaiseril MVP & Adobe Community Professional

              You do not need to get to the widget. Each widget in a group needs to have a unique export value. Then the value for the for the group is the value of the widget or it is the string "Off" if no item is set. Setting the value of the group to "off" unchecks all the radio buttons or check boxes in the group. Setting the value of the group to the export value of one of the buttons in the group checks that button and turns all the other buttons in the group off.

              • 4. Re: script to check a radio button
                MikeABca Level 1

                Thanks so much.  I was over thinking this and it now works great!