dynamically change form structure

Hi,

I want to change the structure of the form at runtime dynamically.

            function loadInv(id) //loads the form with the inventory item details passed by id
            {
                url="http://localhost/vmatrix/index.php/vmatrix/getinventory"+"/"+id;
                alert(url);
                dhxForm.loadStruct(url);
            }

Basically what I’m trying to do is that based on the item selected in a dhtmlxGrid,
I am trying to get an xml from the Codeigniter serverside which will have the structure of the form to be displayed. There are 3 types(structures) of forms to be displayed determined by the serverside based on the id selected.

My problem is that the first time it shows me the form, but if I try to attempt more. The existing form structure does not change. Any idea how this can be done ?

I tried modifying the function like this.

            function loadInv(id) //loads the form with the inventory item details passed by id
            {
                url="<?php echo site_url('vmatrix/getinventoryform'); ?>"+"/"+id;
                alert(url);
                dhxForm.unload();
                dhxForm=dhxLayoutInv.cells("b").attachForm();
                dhxForm.loadStruct(url);
            }

But this one clears the form but does not recreate the new one .
Any idea ?

Hi

Please provide direct link to check issue?
(you can send it to support@dhtmlx.com)

Hello Andrea,

There is no direct link because this is a test setup inside a local intranet. I am sending the complete page code to the reply and the xml file that creates the form.
If this is not helping then I’ll send the complete site code(with mysql file) to your email. Its a code igniter application with dhtmlx as its front end hence the page saved might not reproduce the form correctly.

-thanks,
TestPAge.7z (1.41 MB)

Hi

you demo work a bit incorectly. please provide completed demo and steps how to reproduce issue.

Hello Andrei,

I found out the bug. It was a problem in the xml generation routine which fails on some items. I apologize it was my mistake and thank you very much for all the effort and help.

And your framework is awesome and I have purchased license for the grid component. Hopefully I’ll license the entire framework in near future.

np, feel free if any