Hi I’m trying to build a function that creates a modal window and attaches a form to it dynamically, so I can just call it when ever I need a modal with a form attached.
The issue is that I cant get form controls loaded via the dhx.ajax.get() function
function newFormWindow(formName,width,height,icon,title,_url){
    var win     = formName+"Window";
    var form    = formName+"Form";
    if (this[win]) {
        this[win].destructor();
    }
    this[win] = new dhx.Window({
            title: title,
            width: width,
            height: height,            
            modal: true,
            resizable: false,
            movable: false,
            icon: icon,
            css: win
        });
    this[win].show();
    dhx.ajax.get("/data/forms/test.json").then(function (data) {
        this[form] = new dhx.Form(this[win], data)
        this[win].attach(this[form]);
        this[form].show();
        this[form].events.on("click", function(name, event) {
            console.log(name, event);
        });    
    });
}
The modal window loads and the form HTML div is inserted into it but no controls are added to the form.
Below is the JSON contained in the test.json file
[{
        "type": "input",
        "label": "User Name:",
        "labelPosition": "left",
        "required": true,
        "css": "username",
        "name": "username"
    },
    {
        "type": "input",
        "align": "right",
        "inputType": "password",
        "label": "Password:",
        "labelPosition": "left",
        "required": true,
        "css": "password",
        "name": "password"
    },
    {
        "type": "button",
        "id": "loginbutton",
        "name": "loginbutton",
        "text": "login",
        "size": "medium",
        "view": "flat",
        "position": "right",
        "submit": true,
        "color": "primary",
        "css": "loginButton"
    }]
PLEASE HELP 
 Any ideas ???