Skip to main content
Inspiring
January 17, 2017
Question

Checkbox with multiple selections. Write selections to Properties field

  • January 17, 2017
  • 0 replies
  • 241 views

Hello all,

I have less experience of javascript but from time from time I can reach easy targets with javascript. Now, I have another problem.

I have to run a sequence and the task is: show a check mark box with 7 possible check marks. Take into account that you must be able to select multiple check marks.

The values (the text (description)) has to be reflected to the document properties: "Title". If you selected multiple check marks, there must be a ";" between selection 1 and selection 2.

It would be great if somebody can set me on the right direction.

At this moment, this is the temporary code I tested, but the result is (of course) not correct.

// Dialog Definition

var oDlg = {

        strName: "test",

        cB: "",

        initialize: function(dialog) {

        dialog.load({"usnm":this.strName,});

    },

    commit: function(dialog) {

        var data = dialog.store();

                this.strName = data[ "usnm"];

    },

        checkB: function (dialog){

            this.cB = data["chk1"];

            console.println("CB fct " + this.cB);

        },

    description: {

        name: "Test Dialog",

        elements: [ {

            type: "view",

            elements: [

            {

                name : "Enter the type(s) of manual (e.g. Installation manuals, Operation manuals, Installer reference guide, User reference guide, General safety precautions, Declaration of Conformity, Option handbooks) (use ; if you must select several type of manuals",

                type: "static_text"

            },

            {

                item_id: "usnm",

                type: "edit_text",

                char_width: 30

            },

            {

                                item_id: "chk1",

                                type: "check_box",

                                name: "Installation manuals"

            },

            {

                                item_id: "chk2",

                                type: "check_box",

                                name: "Operation manuals"

            },

            {

                                item_id: "chk3",

                                type: "check_box",

                                name: "Installer reference guide"

            },

            {

                                item_id: "chk4",

                                type: "check_box",

                                name: "User reference guide"

            },

            {

                                item_id: "chk5",

                                type: "check_box",

                                name: "General safety precautions"

            },

            {

                                item_id: "chk6",

                                type: "check_box",

                                name: "Declaration of Conformity"

            },

            {

                                item_id: "chk7",

                                type: "check_box",

                                name: "Option handbooks"

            },

            {

                type: "ok_cancel",

            },

        ] },

    ] },

};

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

       this.info.title=oDlg.cB;

}

this.info.author=""

This topic has been closed for replies.