Select option afeter reload

Hello,

i’m new user of Dhtmlx and I can’t found how to select an item after reload. My Form load some main information and after I load secondary data for different select input, so I have to set the right items for each.

Some one can give me an example ?

Hello, Paul

You can use this sample dhtmlx.com/docs/products/dhtmlxF … eload.html

And in console of your browser type in:

myForm.getCombo('combo').selectOption(3); to select combo option.

myForm.getOptions('msel')[2].selected = true; to select multiselect option.

Ok, thanks for your answer.

I do something like that :

                        scheduler.startLightbox(id, html("my_form"));
                        myform.load('/modules/mobilao/events_formdata.php?id='+ev.id); 
                        myform.reloadOptions("type_event", "/modules/mobilao/events_types.php");

but I think pout a marameter on the reload url to inform the good option to return selected is a better way, can I have acces after the loading of the fata form to the data ?

Something like that :

                        scheduler.startLightbox(id, html("my_form"));
                        myform.load('/modules/mobilao/events_formdata.php?id='+ev.id); 
                        var ev_form = .... 
                        myform.reloadOptions("type_event", "/modules/mobilao/events_types.php?sel=ev_form .idType");

Hi

myform.attachEvent(“onOptionsLoaded”, function(name){

});

This events is run when the loading of data is ok, before writing options.

What I waht is that :

  • I load main data witk some primary keys of others datas
  • I load for a select input the list of secondary data and select one of this data in the select input.

It’s like two select input and the second is loaded and one data is selected depending of the first select input…

Ok I found the solution :

                myform.attachEvent("onOptionsLoaded", function(name) {
                    var values = myform.getFormData();
                    myform.setItemValue("type_event", values['idType']); 
                    return true;
                });

I continue with a strange “bug” :
The event onOptionsLoaded work when load from server but not from an array ? even I use reloadOptions ?

Paul,

how are things going with your code?