1 Reply Latest reply on Feb 27, 2014 12:29 PM by George_Johnson

    Custom Dialog Box w/ Check Box that send out emails

    JRez7884

      Hi, I'm trying to use a script that comes from the following link: http://www.windjack.com/resources/Examples/DialogUses.pdf

      Last button 2#5. The script reads

       

      var FormRouting =

      {

       

       

          result:"cancel",

          DoDialog: function(){return app.execDialog(this);},

          bChk2:false,

          bChk3:false,

          bChk4:false,

          bChk5:false,

          initialize: function(dialog)

          {

              var dlgInit =

              {

                      "Chk2": this.bChk2,

                      "Chk3": this.bChk3,

                      "Chk4": this.bChk4,

                      "Chk5": this.bChk5,

              };

              dialog.load(dlgInit);

          },

          commit: function(dialog)

          {

              var oRslt = dialog.store();

              this.bChk2 = oRslt["Chk2"];

              this.bChk3 = oRslt["Chk3"];

              this.bChk4 = oRslt["Chk4"];

              this.bChk5 = oRslt["Chk5"];

          },

          description:

          {

              name: "Form Routing",

              elements:

              [

                  {

                      type: "view",

                      elements:

                      [

                          {

                              type: "view",

                              char_height: 10,

                              elements:

                              [

                                  {

                                      type: "static_text",

                                      item_id: "stat",

                                      name: "Route Form To:",

                                      char_width: 15,

                                      alignment: "align_fill",

                                      font: "dialog",

                                  },

                                  {

                                      type: "view",

                                      char_width: 8,

                                      char_height: 8,

                                      align_children: "align_top",

                                      elements:

                                      [

                                          {

                                              type: "view",

                                              char_width: 8,

                                              char_height: 8,

                                              elements:

                                              [

                                                  {

                                                      type: "check_box",

                                                      item_id: "Chk2",

                                                      name: "Marketing",

                                                  },

                                                  {

                                                      type: "check_box",

                                                      item_id: "Chk3",

                                                      name: "Sales",

                                                  },

                                                  {

                                                      type: "check_box",

                                                      item_id: "Chk4",

                                                      name: "Accounting",

                                                  },

                                              ]

                                          },

                                          {

                                              type: "view",

                                              char_width: 8,

                                              char_height: 8,

                                              elements:

                                              [

                                                  {

                                                      type: "check_box",

                                                      item_id: "Chk5",

                                                      name: "Engineering",

                                                  },

                                                  {

                                                      type: "check_box",

                                                      item_id: "Chk5",

                                                      name: "Division HQ",

                                                  },

                                                  {

                                                      type: "check_box",

                                                      item_id: "Chk5",

                                                      name: "Corporate",

                                                  },

                                              ]

                                          },

                                      ]

                                  },

                              ]

                          },

                          {

                              type: "ok_cancel",

                          },

                      ]

                  },

              ]

          }

      };

       

       

      // Example Code

      FormRouting.bChk2 = false;

      FormRouting.bChk3 = false;

      FormRouting.bChk4 = false;

      FormRouting.bChk5 = false;

      if("ok" == FormRouting.DoDialog())

      {

       

       

          console.println("Chk2:" + FormRouting.bChk2);

          console.println("Chk3:" + FormRouting.bChk3);

          console.println("Chk4:" + FormRouting.bChk4);

          console.println("Chk5:" + FormRouting.bChk5);

      }

       

       

      I have adjusted the script use in my form, but how do I apply email functions to the check boxes. So when someone fills the form and checks "Marketing" check box, clicks "Ok", it opens an app.mailMsg, set for Marketing Email recipient.

       

      Thank you

        • 1. Re: Custom Dialog Box w/ Check Box that send out emails
          George_Johnson MVP & Adobe Community Professional

          You'd have to change this part of the code:

           

          if("ok" == FormRouting.DoDialog())

          {

              console.println("Chk2:" + FormRouting.bChk2);

              console.println("Chk3:" + FormRouting.bChk3);

              console.println("Chk4:" + FormRouting.bChk4);

              console.println("Chk5:" + FormRouting.bChk5);

          }

           

          so that instead of printing to the console, it determines which check boxes were selected (if any), associates an email address with each selected check box, and includes the email addresses in the app.mailMsg statement. Note that app.mailMsg doesn't work with Reader.