if (event.source.forReal && (event.source.stampName == "#OHuhPI8yWwt8XXKegQxhfB")) { // Dialog Definition var oDlg = { strName: "", strLastName: "", myFolder: "", // This dialog box is called when the dialog box is created initialize: function (dialog) { dialog.load({ "usnm": this.strName }); dialog.load({ "lsnm": this.strLastName }); dialog.load({ "sub1": { // Note: positive value represents the selected item "A": -5, "B": -4, // currently selected item "C": -3, "D": +2, "E": -1 } }); }, // This dialog box is called when the OK button is clicked. commit: function (dialog) { var data = dialog.store(); this.strName = data["usnm"]; this.strLastName = data["lsnm"]; if (data["rd01"]) { this.myFolder = "complete"; } if (data["rd02"]) { this.myFolder = "needGuidance"; } if (data["rd03"]) { this.myFolder = "noActionNeeded"; } // Retrieve the values stored in list_box sub1: //var elements = dialog.store(); // Iterate through items and take actions as needed for (var e in data["sub1"]) // If the value is positive, it was selected: if (data["sub1"][e] > 0) { // display the list value selected: app.alert("You chose:\n" + data["sub1"][e]); // call a related function for the selection rc = data["sub1"][e]; ListHandler(rc); } }, description: { name: "Test Dialog", elements: [ { type: "view", name: "Choose a folder", elements: [ { type: "cluster", name: "Choose a folder", elements: [ /* I'm commenting this section out because it's not necessary for this particular dialog box, but I don't want to forget that this static text area could be useful { type: "static_text", name: "a static text string" },*/ { type: "radio", item_id: "rd01", group_id: "rado", name: "completed folder", value: "complete", }, { type: "radio", item_id: "rd02", group_id: "rado", name: "need guidance", value: "needGuidance", }, { type: "radio", item_id: "rd03", group_id: "rado", name: "no action needed", value: "noActionNeeded", }, ] }, { type: "cluster", name: "Choose a folder", elements: [ { name: "Enter your name:", type: "static_text", }, { item_id: "usnm", type: "edit_text", char_width: 15 }, { name: "Enter your last name:", type: "static_text", }, { item_id: "lsnm", type: "edit_text", char_width: 15 }, ] }, { type: "view", align_children: "align_left", elements: [ { type: "cluster", name: "Provider", elements: [ { type: "static_text", name: "Select Item", font: "default" }, { type: "popup", item_id: "sub1", variable_Name: "sub1", width: 150, height: 20 }, ] } ] }, { type: "ok_cancel", }, ] }, ] } }; // Function to handle the user’s list selection: function ListHandler(sub1) { app.alert(rc); switch (rc) { case 0: this.getField("Date2").value = "A but it was 0" //app.alert("ListHandler response for 1 - one"); break; case 1: this.getField("Date2").value = "A" break; case 2: this.getField("Date2").value = "B" break; case 3: this.getField("Date2").value = "C" break; case 4: this.getField("Date2").value = "D" break; case 5: this.getField("Date2").value = "E" break; default: app.alert("Invalid selection: " + rc); break; } } // Dialog Activation // oDlg.strName = "Larry"; // oDlg.strLastName = "David"; if ("ok" == app.execDialog(oDlg)) { console.println("User Name:" + oDlg.strName + " " + oDlg.strLastName); cMsg = oDlg.strName + " " + oDlg.strLastName event.value = cMsg; app.alert("Radio button selected: " + this.oDlg.myFolder, 4); //event.source.source.info.DocumentState = cMsg; } }