Is it possible to attach form to window?

When looking in the documentation, it seems window has almost every integration besides ‘form’.
↳ When looking here it has no guide on how to attach a form to the window. Is this not possible?

If it is possible, how do I do it?

I made my form in a php file, but I’m not sure what code I need to strip for it to fit in a window.
I found this guide:
And this example: … _form.html
But I think it’s still very hard to understand what I need to do exactly.

① Here is my form code below, could anyone tell me what code I need to strip?
② After stripping am I supposed to link it in the following line?→ myForm.loadStruct("…/common/form.json");



Best regards!


there is 2 parts of initin form:

  1. init new form instance, this is when you call var form = new dhtmlxForm() or var form = someComponent.attachForm()

  2. load form struct. here you can load stuct from client side right after form init or you can generate struct on server side and load via inner form ajax, i.e. form.loadStruct("/path/to/php/script/here") which will return json struct

also ai recommend use inner dhtmlx function to perform default tasks, i.e.
$(‘input[name=id_task]’).val(’’); -> myForm.setItemValue(“id_task”, “”);

Dear Andrei, I was able to get it to work, but originally I used php code in my form to get certain fields. I think you are advising me to use JS/jQuery to fill in some fields instead.

However, if I used this in my original form:

{type: "input", label: "ID", name:"id", value: "<? echo $_GET['id']; ?>"}

And I’ll put the form on top of a grid in the future with an “open form” button somewhere, how would I fill in the ID in a certain field in the form?
You told me:

$('input[name=id_task]').val(''); -> myForm.setItemValue("id_task", "");

But I don’t think I can put it in the json file, right? Where would I put that?

Part I. Init

{type: "input", label: "ID", name:"id", value: "<? echo $_GET['id']; ?>"}

you can:

  1. load both struct and values from cilent (if your struct and values are static)
  2. load both from server (i.e. generated by php)
  3. load struct (no matter from client or server) and then load values (from client or server also no matter)

so first you have to init form on client

var myForm = new dhtmxlForm(...);

then load struct (also you able to do it on init stage)
myForm.loadStruct([{type: “input”,… }]);

then load values with php (for this you have to give json- or xml-formatted data to form, which can be generated with php without needs to insert <? echo $_GET['id']; ?> into html file and mixing content)


here is set of demos (check the first one): … s/06_data/

Part 2. Values

this is not supported officially, but works:


this is supported officially:

myForm.setItemValue("id_task", "");

so we do not guarantee jquery will suitable with the future updates. just advice for you to use public api.