Button command setting - how does it work


#1

On this page: docs.dhtmlx.com/form__other_con … savingdata there is wording

I can’t seem to find the details about the command option on controls button page: docs.dhtmlx.com/form__controls_list.html#button. What I have tried is below. When I click the ok button the event is fired, but the command shows as undefined.

[code]var winId = “win1”;
var myWins = new dhtmlXWindows();
var win = myWins.createWindow(winId, 600, 200, 400, 300);
myWins.window(winId).setText(data.AdjustmentType + " Approval for : " + data.PersonnelNumber+" " +data.EmployeeFullName);
myWins.window(winId).setModal(true);

            var formData = [
                { type: "settings", position: "label-left", labelWidth: 90, inputWidth: 130 },
                {
                    type: "block", width: "auto", blockOffset: "label-left", list: [
                        { type: "settings", position: "label-left", labelWidth: 80, inputWidth: 130 },
                        { _idd: "106", type: "calendar", label: "Effective", dateFormat: "%n/%j/%Y", labelAlign: "left" }
                    ]
                },
                {
                    type: "block", width: "auto", blockOffset: "label-left", list: [
                        { type: "settings", position: "label-left", labelWidth: 80, inputWidth: 130 },
                        { type: "radio", name: "r", label: "Approve", value: "", labelAlign: "left", checked: true },
                        { type: "radio", name: "r", label: "Reject", value: "", labelAlign: "left" }
                    ]
                },
                {
                    type: "block", width: "auto", blockOffset: "label-left", list: [
                        { type: "settings", position: "label-left", labelWidth: "200" },
                        { _idd: "107", type: "input", label: "Rejected Comments", value: "", labelAlign: "left", inputWidth: "300", position: "label-top", rows: "4" }
                    ]
                },
                {
                    type: "block", width: "auto", blockOffset: "label-left", list: [
                        { _idd: "108", name: "windowOkButton", type: "button", value: "OK", inputWidth: "300", position: "label-top",  offsetLeft: "170", command: save2 },
                    { type: "newcolumn" },
                    { _idd: "109", name: "windowCancelButton", type: "button", value: "Cancel", inputWidth: "300", position: "label-top", icon: "icon-button", command: "save" }
                ]
                }
            ];

            
            var dhxForm = myWins.window(winId).attachForm(formData);


            dhxForm.attachEvent("onButtonClick", function (name, command) {

               // if (name == "windowOkButton") {
                console.log("name: " + name);
                    console.log("command: " + command);
              //  }
                
            });

[/code]


#2

Thank you for your note.
This is the deprecated option. Currently it is included. The article in docs will be corrected.