3 Replies Latest reply on Jan 19, 2017 10:37 PM by jessevic

    Popup window with checkbox written in Javascript

    jessevic Level 1

      Hello,

       

      Task of the checkboxes in the popup window is to write the checkbox values to File > Properties > Description > Title.

      If you selected 2 checkboxes, a ";" should be a separator between the 2 fields in the File > Properties > Description > Title field.

      If you select only 1 checkbox, there is NO ; at all.

      If you select 3 checkboxes, the separator is always a ; (in this case 2 times a ; )

       

      This is one of my tries, hope that some freaks can help me.

      I need also to exand the checkboxes until 9 different checkboxes.

       

      var dialog2 =

          {

              initialize: function(dialog) {

                  // Set a default value for radio button field

                  dialog.load({"ckb1": true });

              },

       

              commit: function(dialog) {

                  // When the user presses "Ok", this handler will execute first

                  var results = dialog.store();

              },

       

              // The dialog box description

              description:

              {

                  name: "More Personal Information",

                  elements:

                  [

                      {

                          type: "view",

                          align_children: "align_left",

                          elements:

                          [

                              {

                                  type: "static_text",

                                  name: "Personal Information",

                                  bold: true,

                                  font: "dialog",

                                  char_width: 30,

                                  height: 20

                              },

                              {

                                  type: "check_box",

                                  item_id: "ckb1",

                                  name: "Pet Owner"

                              },

                                                      {

                                  type: "check_box",

                                  item_id: "ckb2",

                                  name: "Pet Owner test"

                              },

                                                                              {

                                  type: "check_box",

                                  item_id: "ckb3",

                                  name: "Pet Owner test"

                              },

                             

                          ]

                      },

       

                      {

                          type: "gap",    //Add a small vertical gap between

                          height: 10      //check boxes and buttons

                      },

       

                      {

                          type: "ok_cancel",

                          ok_name: "Ok",

                          cancel_name: "Cancel"

                      }

                  ]

              }

          };

      this.info.author=""

      if ("ok"==app.execDialog(dialog2)){

          this.info.title=dialog2.results

      };

       

       

       

      Examples

      checkbox 1 and 2 selected results in: Pet Owner;Pet Owner test

      checkbox 1 selected results in: Pet Owner

      checkbox 1 and 2 and 3 selected results in: Pet Owner;Pet Owner test;Pet Owner test

      No checkbox selected results in: <<empty field>>