load multiple forms simultaniously

Hello,

I have a layout with 5 tabs and on each tab a different form. I have a script that loads contents in the 5 different forms with a single mouse click. The script however, calls 5x on a PHP file to extract certain data from the database:

Form1.load("loadform.php?id=frm1");
Form2.load("loadform.php?id=frm2");
Form3.load("loadform.php?id=frm3");
Form4.load("loadform.php?id=frm4");
Form5.load("loadform.php?id=frm5");

It works, but it isn’t very effective of course. Therefore my question is: isn’t there a way to call on the PHP file only once and then load all 5 forms with the gathered data?

Thank you

Hi

you can group all you responses into single one:

{Form1: {name: "Alex", email: "alex@mail.com"}, Form2: {},...}

assuming form struct is the following

var Form1 = new dhtmlXForm("some_div", [{type: "input", name: "name",...}, {type: "input", name: "email",...}]);

and then load data into forms manualy

dhx4.ajax.get("forms.php", function(r){ var data = dhx4.s2j(r.xmlDoc.responseText); for (var a in data) window[a].setFormData(data[a]); })

or split forms like in demos:
dhtmlx.com/docs/products/dhtmlxF … split.html
dhtmlx.com/docs/products/dhtmlxF … mplex.html

Thank you very much, especially the link to the “Split form into tabs” was very helpful!
http://dhtmlx.com/docs/products/dhtmlxForm/samples/05_integration/05_split.html

Is it possible to use the “Split form into tabs” example with XML files? Like with:

myForm.loadStruct("myform.xml")

When I use loadStruct, only the first tab gets populated with the first part of the form whereas my other tabs stay empty.

You need the next:

myForm.loadStruct("../___xml/dhxform_xml2.xml", function(){ tabbar.tabs("tab2").attachObject("block2"); tabbar.tabs("tab3").attachObject("block3"); });
When form stucture is:

<?xml version="1.0"?> <items> <item type="settings" position="label-left" labelWidth="130" inputWidth="120"/> <item type="block" name="block1" id="block1" labelWidth="auto" position="label-right" label="Already have account"> ... </item> <item type="block" name="block2" id="block2" labelWidth="auto" position="label-right" label="Not registered yet"> ... </item> <item type="block" name="block3" id="block3" labelWidth="auto" position="label-right" label="Guest login"> ... </item> </items>