Split form into tabs XML

Hi All

I’m trying to work with the example given in the documentation:
dhtmlx.com/docs/products/dhtmlxF … split.html

I’ve been trying to use this example with a formatted XML file. Would some be so kind as to help me by providing an xml file that would work with the example in the documentation.

Thanks in advance

Hi
You need to use the next approach:

myForm.loadStruct("dhxform_xml2.xml", function(){ tabbar.tabs("tab2").attachObject("block2"); tabbar.tabs("tab3").attachObject("block3"); });

Thanks for the quick reply.

I’ve added your code in for proof of concept of this and it’s still not separating the blocks. I’ve attached the xml file I’m using. Could you kindly take a look and let me know where I’m gone wrong?

[code] hla.windowSettingsTabbar = hla.windowSettings.attachTabbar();

hla.windowSettingsTabbar.addTab("t1","Worklist");
hla.windowSettingsTabbar.addTab("t2",'Other1');
hla.windowSettingsTabbar.addTab("t3",'Other2');
hla.windowSettingsTabbar._setTabActive("t1");

hla.SettingsForm = hla.windowSettingsTabbar.cells("t1").attachForm();
hla.SettingsForm.loadStruct("data/frmSettings.xml", function(){
    hla.windowSettingsTabbar.tab("t2").attachObject("tab2");
    hla.windowSettingsTabbar.tab("t3").attachObject("tab3");
});[/code]

frmSettings.xml.zip (548 Bytes)

What dhtmlx version do you use? Locally works fine with your XML

Hi Darya

I’m running dhtmlxSuite_v412_std. I’ve tried a few things:

The following code from your samples/documentation seems to work putting the blocks into the 3 tabs.

[code]hla.OpenSettings = function() {

dhxWins = new dhtmlXWindows();

w1 = dhxWins.createWindow("w1", 20, 30, 400, 280);
w1.setText("Settings");

//
myTabbar = w1.attachTabbar({
    tabs: [
        {id: "a1", label: "Tab 1", active: true},
        {id: "a2", label: "Tab 2"},
        {id: "a3", label: "Tab 3"}
    ]
});
formData = [
    {type: "settings", position: "label-left", labelWidth: 145, inputWidth: 150},
    {type: "block", inputWidth: "auto", list:[
        {type: "input", offsetTop: 14, label: "Login", value: "p_rossi"},
        {type: "password", label: "Password", value: "123"},
        {type: "checkbox", label: "Remember me", checked: true}
    ]},
    {type: "block", inputWidth: "auto", id: "tab2", list:[
        {type: "input", offsetTop: 14, label: "Full Name", value: "Patricia D. Rossi"},
        {type: "input", label: "E-mail Address", value: "p_rossi@example.com"},
        {type: "input", label: "Login", value: "p_rossi"},
        {type: "password", label: "Password", value: "123"},
        {type: "password", label: "Confirm Password", value: "123"},
        {type: "checkbox", label: "Subscribe on news"}
    ]},
    {type: "block", inputWidth: "auto", id: "tab3", position: "absolute", list:[
        {type: "select", offsetTop: 14, label: "Account type", options:[
            {text: "Admin", value: "admin"},
            {text: "Organiser", value: "org"},
            {text: "Power User", value: "poweruser"},
            {text: "User", value: "user"}
        ]},
        {type: "checkbox", label: "Show logs window"}
    ]}
    ];

myForm = myTabbar.cells("a1").attachForm(formData);
//myForm.loadStruct("data/frmSettings.xml");
myTabbar.cells("a2").attachObject("tab2");
myTabbar.cells("a3").attachObject("tab3");

};[/code]

When I then try and use my previously attached XML it puts everything into tab 1.

[code]hla.OpenSettings = function() {

dhxWins = new dhtmlXWindows();

w1 = dhxWins.createWindow("w1", 20, 30, 400, 280);
w1.setText("Settings");

//
myTabbar = w1.attachTabbar({
    tabs: [
        {id: "a1", label: "Tab 1", active: true},
        {id: "a2", label: "Tab 2"},
        {id: "a3", label: "Tab 3"}
    ]
});

myForm = myTabbar.cells("a1").attachForm();
myForm.loadStruct("data/frmSettings.xml");
myTabbar.cells("a2").attachObject("tab2");
myTabbar.cells("a3").attachObject("tab3");

};[/code]

Are you sure my XML is formatted OK?

Does someone have a sample XML that includes blocks and fieldsets

Thanks again for your time.

Doh!..I forgot to add your solution. It now works as expected…

[code]hla.OpenSettings = function() {

dhxWins = new dhtmlXWindows();

w1 = dhxWins.createWindow("w1", 20, 30, 400, 280);
w1.setText("Settings");

//
myTabbar = w1.attachTabbar({
    tabs: [
        {id: "a1", label: "Tab 1", active: true},
        {id: "a2", label: "Tab 2"},
        {id: "a3", label: "Tab 3"}
    ]
});

myForm = myTabbar.cells("a1").attachForm();
myForm.loadStruct("data/frmSettings.xml",function(){
myTabbar.cells("a2").attachObject("tab2");
myTabbar.cells("a3").attachObject("tab3");
});

};[/code]