2 Replies Latest reply on Apr 25, 2014 8:14 AM by RtheFree

    Show the filename in a edit_text box in a stamp dialog

    RtheFree

      Hi,

       

      Im tryint to create a stamp that pops-up dialog.

      One of the dialog text box must be filled in by default with the filename of the document that has to be stamped.

       

      This is a part of the code:

      var dialog = {

      issuepurposeValue: "",

      reviewresultcodeValue: "",

      nextissuestatusValue: "",

      resubmissiondateValue: "",

      respdept1Value: "",

      sigrespdept1Value: "",

      relateddept1Value: "",

      sigrelateddept1Value: "",

      relateddept2Value: "",

      sigrelateddept2Value: "",

      dateValue: "",

      reqnumValue: "",

      docnumberValue: "",

      docrevValue: "",

       

       

       

      initialize: function(dialog) {

      dialog.load({

      "radA": true,

      "radF": true,

      "radL": true,

      "cbxA": true,

      "radP": true,

      "radR": false,

      "txtM": documentFileName,

      "txtK": util.printd("dd-mmm-yyyy", new Date()),

      });

      this.dateValue = false;

      this.resubmissiondateValue = false

      dialog.enable({

      "txtD": this.resubmissiondateValue,

      "txtK": this.dateValue

      } )

      },

       

      cbxA: function (dialog) {

      this.dateValue = !this.dateValue;

      dialog.enable({"txtK": this.dateValue});

      },

       

      radR: function (dialog) {

      this.resubmissiondateValue =! this.resubmissiondateValue;

      dialog.enable({

      "txtD": true,

      });

      },

       

      radP: function (dialog) {

      this.resubmissiondateValue =! this.resubmissiondateValue;

      dialog.enable({

      "txtD": false,

      });

      },

       

      radQ: function (dialog) {

      this.resubmissiondateValue =! this.resubmissiondateValue;

      dialog.enable({

      "txtD": false,

      });

      },

       

       

       

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

      var results = dialog.store();

      if(results["radA"] == true) {this.issuepurposeValue = "FR"};

      if(results["radB"] == true) {this.issuepurposeValue = "FN"};

      if(results["radC"] == true) {this.issuepurposeValue = "FI"};

      if(results["radD"] == true) {this.issuepurposeValue = "AB"};

      if(results["radE"] == true) {this.issuepurposeValue = ""};

       

      if(results["radF"] == true) {this.reviewresultcodeValue = "A"};

      if(results["radG"] == true) {this.reviewresultcodeValue = "B"};

      if(results["radH"] == true) {this.reviewresultcodeValue = "N"};

      if(results["radI"] == true) {this.reviewresultcodeValue = "F"};

      if(results["radJ"] == true) {this.reviewresultcodeValue = ""};

       

      if(results["radK"] == true) {this.nextissuestatusValue = "FR"};

      if(results["radL"] == true) {this.nextissuestatusValue = "FN"};

      if(results["radM"] == true) {this.nextissuestatusValue = "FI"};

      if(results["radN"] == true) {this.nextissuestatusValue = "AB"};

      if(results["radO"] == true) {this.nextissuestatusValue = ""};

       

      if(results["radP"] == true) { this.resubmissiondateValue = "Within 2 weeks"};

      if(results["radQ"] == true) { this.resubmissiondateValue = "In MDR"};

      if(results["radR"] == true) { this.resubmissiondateValue = results["txtD"]};

       

      this.respdept1Value = results["txtE"];

      this.sigrespdept1Value = results["txtF"];

      this.relateddept1Value = results["txtG"];

      this.sigrelateddept1Value = results["txtH"];

      this.relateddept2Value = results["txtI"];

      this.sigrelateddept2Value = results["txtJ"];

       

      if(results["cbxA"] == false) {this.dateValue = results["txtK"]};

      if(results["cbxA"] == true) {this.dateValue = util.printd("dd-mmm-yyyy", new Date())};

       

      this.reqnumValue = results["txtL"];

      this.docnumberValue = results["txtM"];

      this.docrevValue = results["txtN"];

      },

       

      description:

      ------------------------------------------

      The problem is in "txtM" if i put under initialize "txtM": documentFileName, it returns the stamp name and i need the filename.

       

      hope anyone can help.

       

      Robbert

        • 1. Re: Show the filename in a edit_text box in a stamp dialog
          gkaiseril MVP & Adobe Community Professional

          "documentFileName" is the property of what JS object?

           

          It is a good coding practice to either explicitly use the object or provide a variable that provides the object.

          • 2. Re: Show the filename in a edit_text box in a stamp dialog
            RtheFree Level 1

            I'm not that good in writing java scripts codes. all my codes come from stealing and modifying with trial and error.

             

            for your understanding find below the complete stamp code. The stamp is being used as a company approval stamp. a part of this stamp provides the document number of the checked document. to make it easy for the user of the stamp i want to retrieve the document file name as this is most of the time equal to the document number it self.

             

            "txtM" is the id-tag for a type edit_text box for filling the document number.

             

            -----------------------

            var dialog = {

            issuepurposeValue: "",

            reviewresultcodeValue: "",

            nextissuestatusValue: "",

            resubmissiondateValue: "",

            respdept1Value: "",

            sigrespdept1Value: "",

            relateddept1Value: "",

            sigrelateddept1Value: "",

            relateddept2Value: "",

            sigrelateddept2Value: "",

            dateValue: "",

            reqnumValue: "",

            docnumberValue: "",

            docrevValue: "",

             

             

             

            initialize: function(dialog) {

            dialog.load({

            "radA": true,

            "radF": true,

            "radL": true,

            "cbxA": true,

            "radP": true,

            "radR": false,

            "txtM": documentFileName,

            });

            this.dateValue = false;

            this.resubmissiondateValue = false

            dialog.enable({

            "txtD": this.resubmissiondateValue,

            "txtK": this.dateValue

            } )

            },

             

            cbxA: function (dialog) {

            this.dateValue = !this.dateValue;

            dialog.enable({"txtK": this.dateValue});

            },

             

            radR: function (dialog) {

            this.resubmissiondateValue =! this.resubmissiondateValue;

            dialog.enable({

            "txtD": true,

            });

            },

             

            radP: function (dialog) {

            this.resubmissiondateValue =! this.resubmissiondateValue;

            dialog.enable({

            "txtD": false,

            });

            },

             

            radQ: function (dialog) {

            this.resubmissiondateValue =! this.resubmissiondateValue;

            dialog.enable({

            "txtD": false,

            });

            },

             

             

             

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

            var results = dialog.store();

            if(results["radA"] == true) {this.issuepurposeValue = "FR"};

            if(results["radB"] == true) {this.issuepurposeValue = "FN"};

            if(results["radC"] == true) {this.issuepurposeValue = "FI"};

            if(results["radD"] == true) {this.issuepurposeValue = "AB"};

            if(results["radE"] == true) {this.issuepurposeValue = ""};

             

            if(results["radF"] == true) {this.reviewresultcodeValue = "A"};

            if(results["radG"] == true) {this.reviewresultcodeValue = "B"};

            if(results["radH"] == true) {this.reviewresultcodeValue = "N"};

            if(results["radI"] == true) {this.reviewresultcodeValue = "F"};

            if(results["radJ"] == true) {this.reviewresultcodeValue = ""};

             

            if(results["radK"] == true) {this.nextissuestatusValue = "FR"};

            if(results["radL"] == true) {this.nextissuestatusValue = "FN"};

            if(results["radM"] == true) {this.nextissuestatusValue = "FI"};

            if(results["radN"] == true) {this.nextissuestatusValue = "AB"};

            if(results["radO"] == true) {this.nextissuestatusValue = ""};

             

            if(results["radP"] == true) { this.resubmissiondateValue = "Within 2 weeks"};

            if(results["radQ"] == true) { this.resubmissiondateValue = "In MDR"};

            if(results["radR"] == true) { this.resubmissiondateValue = results["txtD"]};

             

            this.respdept1Value = results["txtE"];

            this.sigrespdept1Value = results["txtF"];

            this.relateddept1Value = results["txtG"];

            this.sigrelateddept1Value = results["txtH"];

            this.relateddept2Value = results["txtI"];

            this.sigrelateddept2Value = results["txtJ"];

             

            if(results["cbxA"] == false) {this.dateValue = results["txtK"]};

            if(results["cbxA"] == true) {this.dateValue = util.printd("dd-mmm-yyyy", new Date())};

             

            this.reqnumValue = results["txtL"];

             

            this.docnumberValue = results["txtM"];

            this.docrevValue = results["txtN"];

            },

             

            description:

            {                     

            name: "Issue Purpose Column",// Dialog box title

            elements:

            [                     

            {                     

            type: "cluster",

            name: "Purpose, Result and Next Issue",

            align_children: "align_left",

            elements:

            [                     

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [                     

            {

            name: "Issue Purpose",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

             

            {

            type: "radio",

            item_id: "radA",

            group_id: "purp",

            name: "For Review (FR)",

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radB",

            group_id: "purp",

            name: "For Final (FN)",

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radC",

            group_id: "purp",

            name: "For Information (FI)" ,

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radD",

            group_id: "purp",

            name: "As Build (AB)" ,

            char_width: 14,

            },                   

            {

            type: "radio",

            item_id: "radE",

            group_id: "purp",

            name: "Not Applicable" ,

            },                   

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {                     

            name: "Review Result Code",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            type: "radio",

            item_id: "radF",

            group_id: "resu",

            name: "A Approved (A)",

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radG",

            group_id: "resu",

            name: "B Approved (B)",

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radH",

            group_id: "resu",

            name: "Not Accepted (N)" ,

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radI",

            group_id: "resu",

            name: "For Information (F)" ,

            char_width: 14,

            },                   

            {

            type: "radio",

            item_id: "radJ",

            group_id: "resu",

            name: "Not Applicable" ,

            },                   

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

                                   name: "Next Issue Status ",

            type: "static_text",

            char_width: 14,

            }, 

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            type: "radio",

            item_id: "radK",

            group_id: "next",

            name: "For Review (FR)",

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radL",

            group_id: "next",

            name: "For Final (FN)",

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radM",

            group_id: "next",

            name: "For Information (FI)" ,

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radN",

            group_id: "next",

            name: "As Build (AB)" ,

            char_width: 14,

            },

            {

            type: "radio",

            item_id: "radO",

            group_id: "next",

            name: "Not Applicable" ,

            },                   

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

                                   name: "Resubmission Date",

            type: "static_text",

            char_width: 14,

            }, 

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            type: "radio",

            item_id: "radP",

            group_id: "resub",

            name: "Within 2 weeks" ,

            char_width: 14,

            },                   

            {

            type: "radio",

            item_id: "radQ",

            group_id: " resub ",

            name: "In MDR" ,

            char_width: 14,

            },                   

            {

            type: "radio",

            item_id: "radR",

            group_id: " resub ",

            name: "Other" ,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtD",

            type: "edit_text",

            multiline: false,

            width: 308,

            height: 20                                             

            }                     

            ]                     

            },

                                                                                   ]

                                                           },

            {                     

            type: "cluster",

            name: "Responsible Dept. and person",

            align_children: "align_left",

            elements:

            [                     

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

            name: "Responsible Department",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {                     

            item_id: "txtE",

            type: "edit_text",

            multiline: false,

            width: 100,

            height: 20

            },

            {

            name: "Responsible Person (Abbreviation)",

            type: "static_text",

            char_width: 19,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtF",

            type: "edit_text",

            multiline: false,

            width: 371,

            height: 20                                             

            },                   

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

            name: "Related Department #1",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtG",

            type: "edit_text",

            multiline: false,

            width: 100,

            height: 20

            },

            {

            name: "Related Person #1 (Abbreviation)",

            type: "static_text",

            char_width: 19,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtH",

            type: "edit_text",

            multiline: false,

            width: 371,

            height: 20                                             

            },                   

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

            name: "Related Department #2",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtI",

            type: "edit_text",

            multiline: false,

            width: 100,

            height: 20

            },

            {

            name: "Related Person #2 (Abbreviation)",

            type: "static_text",

            char_width: 19,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtJ",

            type: "edit_text",

            multiline: false,

            width: 371,

            height: 20                                             

            }                     

            ]                     

            },

                                                                                   ]

                                                           },

            {                     

            type: "cluster",

            name: "Document information",

            align_children: "align_left",

            elements:

            [                     

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

            name: "Date",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            type: "check_box",

            item_id: "cbxA",

            name: "Today or",

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtK",

            type: "edit_text",

            multiline: false,

            width: 189,

            height: 20

            },

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

            name: "Requisition Number",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtL",

            type: "edit_text",

            multiline: false,

            width: 300,

            height: 20                                             

            },                   

            ]                     

            },

            {                     

            type: "view",

            align_children: "align_row",

            elements:

            [

            {

            name: "Document Number",

            type: "static_text",

            char_width: 14,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtM",

            type: "edit_text",

            variable_Name: "edit",

            multiline: false,

            width: 300,

            height: 20

            },

            {

            name: "Revision",

            type: "static_text",

            char_width: 3,

            },

            {

            name: ":",

            type: "static_text",

            char_width: 1,

            },

            {

            item_id: "txtN",

            type: "edit_text",

            multiline: false,

            width: 50,

            height: 20                                             

            }                     

            ]                     

            },

                                                                                   ]

                                                           },

            {                     

            type: "ok_cancel",

            ok_name: "Ok",

            cancel_name: "Cancel"

            ]

            };

             

            //app.execDialog(dialog);

            if(event.source.forReal && (event.source.stampName == "#DXpvGqB1uiHTWNVyDOHTnC"))

             

            {

              if ("ok" == app.execDialog(dialog))

              {

            var cMsg = dialog.issuepurposeValue;

            event.value = "\n" + cMsg;

            event.source.source.info.reviewresultcode = cMsg;

             

            cMsg = "\n" + dialog.reviewresultcodeValue;

            this.getField("reviewresultcode").value = cMsg;

            event.source.source.info.nextissuestatus = cMsg;

             

            cMsg = "\n" + dialog.nextissuestatusValue;

            this.getField("nextissuestatus").value = cMsg;

            event.source.source.info.resubmissiondate = cMsg;

             

            cMsg = "\n" + dialog.resubmissiondateValue;

            this.getField("resubmissiondate").value = cMsg;

            event.source.source.info.respdept1 = cMsg;

             

            cMsg = "\n" + dialog.respdept1Value;

            this.getField("respdept1").value = cMsg;

            event.source.source.info.sigrespdept1 = cMsg;

             

            cMsg = "\n" + dialog.sigrespdept1Value;

            this.getField("sigrespdept1").value = cMsg;

            event.source.source.info.relateddept1 = cMsg;

             

            cMsg = "\n" + dialog.relateddept1Value;

            this.getField("relateddept1").value = cMsg;

            event.source.source.info.sigrelateddept1 = cMsg;

             

            cMsg = "\n" + dialog.sigrelateddept1Value;

            this.getField("sigrelateddept1").value = cMsg;

            event.source.source.info.relateddept2 = cMsg;

             

            cMsg = "\n" + dialog.relateddept2Value;

            this.getField("relateddept2").value = cMsg;

            event.source.source.info.sigrelateddept2 = cMsg;

             

            cMsg = "\n" + dialog.sigrelateddept2Value;

            this.getField("sigrelateddept2").value = cMsg;

            event.source.source.info.date = cMsg;

             

            cMsg = "\n" + dialog.dateValue;

            this.getField("date").value = cMsg;

            event.source.source.info.reqnum = cMsg;

             

            cMsg = "\n" + dialog.reqnumValue;

            this.getField("reqnum").value = cMsg;

            event.source.source.info.docnumber = cMsg;

             

            cMsg = "\n" + dialog.docnumberValue;

            this.getField("docnumber").value = cMsg;

            event.source.source.info.docrev = cMsg;

             

            cMsg = "\n" + dialog.docrevValue;

            this.getField("docrev").value = cMsg;

              }

            }

             

            --------------------------------------