I cant get my values to be written away

New Here ,
Nov 13, 2018

Copy link to clipboard

Copied

I am trying to get a pop-up screen, where you can fill in data.

This data needs to get added into dynamic stamp.

But i cant get i presented ? can anyone help me ?

// JScript source code

function dialog()

    {

var dialogDescriptor =

    {

description:

    {

            name: "NTA Enexis test",

back_color: "windowBackground",

gradient_type: "darkToLight",

elements: [

    {

type: "static_text",

name: "STATUS",

},

{

    width: 200,

height: 22,

type: "popup",

item_id: "pop1",

},

{

type: "static_text",

name: "UITVOERDER",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "pop2",

PopupEdit: true,

SpinEdit: true,

},

{

type: "static_text",

name: "REVISIE NR.",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "pop3",

PopupEdit: true,

SpinEdit: true,

},

{

type: "static_text",

name: "PROJECT NR.",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "txt1",

},

{

type: "ok_cancel",

                ok_name: "MAAK STEMPEL",

                cancel_name: "ANNULEREN",

}

]

            },

            initialize : function(dialog)

        {

        dialog.load({

                "pop1": dialogObject.pop1,

                "pop2": dialogObject.pop2,

                "pop3": dialogObject.pop3,

                "txt1": dialogObject.txt1,

                });

            },

        validate : function(dialog)

    {

//add validate code here

return true;

    },

    commit : function(dialog){ //oproepen wanneer OK drukt

var elements = dialog.store();

dialogObject.pop1 = elements["pop1"];

dialogObject.pop2 = elements["pop2"];

dialogObject.pop3 = elements["pop3"];

dialogObject.txt1 = elements["txt1"];

            var results = dialog.store(); 

            this.status = results[ "pop1"];

            this.uitvoerder = results[ "pop2"];

            this.versie = results[ "pop3"];

            this.projectnr = results[ "txt1"];

    },

    "pop1" : function(dialog)

    {

    },

    "pop2" : function(dialog)

    {

    },

    "pop3" : function(dialog)

    {

    },

    "txt1" : function(dialog)

    {

    },

    };

var dialogObject =

{

pop1: ({CONCEPT:-1, DEFINITIEF:-2, DEMONTAGE:-3, GECONTROLEERD:-4, GOEDGEKEURD:-5, KOPIE:-6, NIEUW:-8, 'TER INFORMATIE':-9, VERVALLEN:-10, 'VIA REVISIE RETOUR':-7, 'VOOR AANBESTEDING':-11}),

pop2: ({ENGIE:-1, OMEXCON:-3, TECHNIP:-2}),

pop3: ({'0.1':-1, '0.2':-2, '0.3':-3, '0.4':-4, '0.5':-5, '0.6':-6, '0.7':-7, '0.8':-8, '0.9':-9, '1.0':-10, '1.1':-11, '1.2':-12, '1.3':-13, '1.4':-14, '1.5':-15, '1.6':-16, '1.7':-17, '1.8':-18, '1.9':-19, '2.0':-20}),

txt1: "",

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

selectedItem: function (control) { if (typeof (control) === "string") { control = this[control]; } for (var item in control) { if (typeof (control[item]) === "object") { var r = this.selectedItem(control[item]);if (r !== undefined){ return r; }} else { if (control[item] > 0){return control[item];}}}} };

return dialogObject;

}

var d = dialog();

if(event.source.forReal && (event.source.stampName == "#yOjTiwY_NBmJz9E2d3yukC")) //kijken of stempel toegepast wordt, alleen deze

d.execDialog();

var cMsg  = dialog.projectnr;

var cMsg1 = dialog.status;

var cMsg2 = dialog.uitvoerder;

var cMsg3 = dialog.status;

this.getField("PROJECT NR").value = cMsg;

this.getField("VERSIE").value = cMsg1;

this.getField("UITVOERDER").value = cMsg2;

this.getField("STATUS").value = cMsg3;

thank you in advance

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Debug your code and look at the value of the status variable. It's not a literal String, but a so-called "object Aggregate", from which you need to extract the selected value.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

122

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

I cant get my values to be written away

New Here ,
Nov 13, 2018

Copy link to clipboard

Copied

I am trying to get a pop-up screen, where you can fill in data.

This data needs to get added into dynamic stamp.

But i cant get i presented ? can anyone help me ?

// JScript source code

function dialog()

    {

var dialogDescriptor =

    {

description:

    {

            name: "NTA Enexis test",

back_color: "windowBackground",

gradient_type: "darkToLight",

elements: [

    {

type: "static_text",

name: "STATUS",

},

{

    width: 200,

height: 22,

type: "popup",

item_id: "pop1",

},

{

type: "static_text",

name: "UITVOERDER",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "pop2",

PopupEdit: true,

SpinEdit: true,

},

{

type: "static_text",

name: "REVISIE NR.",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "pop3",

PopupEdit: true,

SpinEdit: true,

},

{

type: "static_text",

name: "PROJECT NR.",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "txt1",

},

{

type: "ok_cancel",

                ok_name: "MAAK STEMPEL",

                cancel_name: "ANNULEREN",

}

]

            },

            initialize : function(dialog)

        {

        dialog.load({

                "pop1": dialogObject.pop1,

                "pop2": dialogObject.pop2,

                "pop3": dialogObject.pop3,

                "txt1": dialogObject.txt1,

                });

            },

        validate : function(dialog)

    {

//add validate code here

return true;

    },

    commit : function(dialog){ //oproepen wanneer OK drukt

var elements = dialog.store();

dialogObject.pop1 = elements["pop1"];

dialogObject.pop2 = elements["pop2"];

dialogObject.pop3 = elements["pop3"];

dialogObject.txt1 = elements["txt1"];

            var results = dialog.store(); 

            this.status = results[ "pop1"];

            this.uitvoerder = results[ "pop2"];

            this.versie = results[ "pop3"];

            this.projectnr = results[ "txt1"];

    },

    "pop1" : function(dialog)

    {

    },

    "pop2" : function(dialog)

    {

    },

    "pop3" : function(dialog)

    {

    },

    "txt1" : function(dialog)

    {

    },

    };

var dialogObject =

{

pop1: ({CONCEPT:-1, DEFINITIEF:-2, DEMONTAGE:-3, GECONTROLEERD:-4, GOEDGEKEURD:-5, KOPIE:-6, NIEUW:-8, 'TER INFORMATIE':-9, VERVALLEN:-10, 'VIA REVISIE RETOUR':-7, 'VOOR AANBESTEDING':-11}),

pop2: ({ENGIE:-1, OMEXCON:-3, TECHNIP:-2}),

pop3: ({'0.1':-1, '0.2':-2, '0.3':-3, '0.4':-4, '0.5':-5, '0.6':-6, '0.7':-7, '0.8':-8, '0.9':-9, '1.0':-10, '1.1':-11, '1.2':-12, '1.3':-13, '1.4':-14, '1.5':-15, '1.6':-16, '1.7':-17, '1.8':-18, '1.9':-19, '2.0':-20}),

txt1: "",

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

selectedItem: function (control) { if (typeof (control) === "string") { control = this[control]; } for (var item in control) { if (typeof (control[item]) === "object") { var r = this.selectedItem(control[item]);if (r !== undefined){ return r; }} else { if (control[item] > 0){return control[item];}}}} };

return dialogObject;

}

var d = dialog();

if(event.source.forReal && (event.source.stampName == "#yOjTiwY_NBmJz9E2d3yukC")) //kijken of stempel toegepast wordt, alleen deze

d.execDialog();

var cMsg  = dialog.projectnr;

var cMsg1 = dialog.status;

var cMsg2 = dialog.uitvoerder;

var cMsg3 = dialog.status;

this.getField("PROJECT NR").value = cMsg;

this.getField("VERSIE").value = cMsg1;

this.getField("UITVOERDER").value = cMsg2;

this.getField("STATUS").value = cMsg3;

thank you in advance

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Debug your code and look at the value of the status variable. It's not a literal String, but a so-called "object Aggregate", from which you need to extract the selected value.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

123

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 13, 2018 0
Most Valuable Participant ,
Nov 13, 2018

Copy link to clipboard

Copied

Your return value is not the "dialog" variable, but the "d" variable. Also, it's not so easy to access the return values within in because of the way you constructed it. I would recommend getting rid of all the "dialog" function you created and just using a dialog object directly. That will make things much easier.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 13, 2018 0
New Here ,
Nov 13, 2018

Copy link to clipboard

Copied

I started over, and build it a different way, now it works only 1 field not completely good yet.

var dialog = {

status: "",

uitvoerder: "",

versie: "",

projectnr: "",

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

                var results = dialog.store();

                this.status = results["pop1"];

                this.uitvoerder = results["pop2"];

                this.versie = results["pop3"];

                this.projectnr = results["txt1"];

        },

            initialize : function(dialog)

        {

        dialog.load({

                "pop1": dialogObject.pop1,

                "pop2": dialogObject.pop2,

                "pop3": dialogObject.pop3,

                "txt1": dialogObject.txt1,

                });

            },

        description:

        {      

            name: "NTA Enexis test",

back_color: "windowBackground",

gradient_type: "darkToLight",

elements: [    

                        {      

                                type: "view",

                                elements:

                                [      

                                         {

type: "static_text",

name: "STATUS",

},

{

    width: 200,

height: 22,

type: "popup",

item_id: "pop1",

},

{

type: "static_text",

name: "UITVOERDER",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "pop2",

PopupEdit: true,

SpinEdit: true,

},

{

type: "static_text",

name: "REVISIE NR.",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "pop3",

PopupEdit: true,

SpinEdit: true,

},

{

type: "static_text",

name: "PROJECT NR.",

},

{

width: 200,

height: 22,

type: "edit_text",

item_id: "txt1",

},

{

type: "ok_cancel",

                ok_name: "MAAK STEMPEL",

                cancel_name: "ANNULEREN",

}  

                        ]      

                        },     

                ]      

        }      

};

var dialogObject =

{

pop1: ({CONCEPT:-1, DEFINITIEF:-2, DEMONTAGE:-3, GECONTROLEERD:-4, GOEDGEKEURD:-5, KOPIE:-6, NIEUW:-8, 'TER INFORMATIE':-9, VERVALLEN:-10, 'VIA REVISIE RETOUR':-7, 'VOOR AANBESTEDING':-11}),

pop2: ({ENGIE:-1, OMEXCON:-3, TECHNIP:-2}),

pop3: ({'0.1':-1, '0.2':-2, '0.3':-3, '0.4':-4, '0.5':-5, '0.6':-6, '0.7':-7, '0.8':-8, '0.9':-9, '1.0':-10, '1.1':-11, '1.2':-12, '1.3':-13, '1.4':-14, '1.5':-15, '1.6':-16, '1.7':-17, '1.8':-18, '1.9':-19, '2.0':-20}),

txt1: "",

}

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

{

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

  {

    var cMsg = dialog.projectnr;

    event.value = cMsg;

    event.source.source.info.company = cMsg;

    cMsg = dialog.uitvoerder;

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

    cMsg = dialog.status;

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

    cMsg = dialog.versie;

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

  }

}

the pulldown menu on Status doesn't want to take it over to Cmsg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 13, 2018 0
Most Valuable Participant ,
Nov 13, 2018

Copy link to clipboard

Copied

Debug your code and look at the value of the status variable. It's not a literal String, but a so-called "object Aggregate", from which you need to extract the selected value.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 13, 2018 1