2 Replies Latest reply on Sep 19, 2012 4:15 AM by m_s_moran

    Radio button in Acrobat Javascript Dialog

    m_s_moran

      Newbie, but not afraid to strut my ignorance, if it will get me help.  I want this script to launch as a custom calculation script for a dynamic stamp. I just can't get a value for the radio button> This is where I'm at:

      __________________________________________________________


      var dialog = {
        retString: "",

        commit:function (dialog) { // called when OK pressed
          var results = dialog.store();
        },

        description:
        {
          name: "Document Sealing",    // Dialog box title
          elements:
          [
            {
              type: "view",
              elements:
              [
              {
                  type: "radio",
                  item_id: "sub1",
                  group_id: "g1",
                  name: "Not Sealed",
                  width: 200,
                  height: 25
              },
              {
                  type: "radio",
                  item_id: "sub2",
                  group_id: "g1",
                  name: "Sealed",
                  width: 200,
                  height: 25
              },
              {
                  type: "radio",
                  item_id: "sub3",
                  group_id: "g1",
                  name: "Partially Sealed",
                  width: 200,
                  height: 25
              },
               {
                  type: "ok_cancel",
                  ok_name: "Ok",
                  cancel_name: "Cancel"
                },
              ]
            },
          ]
        }
      };

      if(event.source.forReal && (event.source.stampName == "#ERUOSX5CkPZixTOImPQJqA"))
      {
        if ("ok" == app.execDialog(dialog))
        {
          if("sub1" == 1)
          {
          var cMsg = "Not Sealed";
          event.value = cMsg;
          }  
        }
      }

      ____________________________________________________

       

      Any guidance would be most appreciated.

       

      Mike

        • 1. Re: Radio button in Acrobat Javascript Dialog
          try67 MVP & Adobe Community Professional

          Before the dialog create a variable that will hold the user's selection:

          var sealing;

           

          Then in the commit event of the dialog you check which radio-button is selected and assign a value to this variable accordingly, like so:

           

            commit:function (dialog) { // called when OK pressed

              var results = dialog.store();

              if (results["sub1"]) sealing = 1;

              else if (results["sub2"]) sealing = 2;

              else if (results["sub3"]) sealing = 3;

            }

           

          Then after the dialog has been closed you use the value of this variable in the rest of your script, such as:

          if (sealing==1) {

            event.value = "Not Sealed";

          }

          • 2. Re: Radio button in Acrobat Javascript Dialog
            m_s_moran Level 1

            Try67, your suggestion worked perfectly. Many thanks for you assistance.

             

            Mike