load combo before load data form

Hi,
I have a form that contains input fields and six combo fields .
When I load the form, before I have to load the data of the combo, and only after loading the form data.

combo1.load(‘loadcomb1.php?P=a’);

combo6.load(‘loadcomb6.php?X=e’);

form_1.load(“loadform.php?E=a”)

but in this way, the load of the form begins before the load of some combo, with the result to have some combo empty.
How can I do, to start the load of the form only if the load of the combo is over

I also tried to delay window.setTimeout with the load of the form, but without success

window.setTimeout(form_20.load(“loadform.php?E=a”),1000);

window.setTimeout(form_20.load(“loadform.php?E=a”),10000);

That’s correct, with async loading such behaviour is possible.

Try the following:

  1. specify “connector” attr to combo in a formStruct instead of combo1.load()
  2. load formStruct and then load formData in callback

i.e.

var myForm = new dhtmlXForm("parent_id"); myForm.loadStruct([...]); myForm.load("loadform.php?E=a"); // or via callback if loading from url myForm.loadStruct("url", function() { myForm.load("loadform.php?E=a"); });

Andrei thank you for your response.
I was trying to do
combo1.load(‘loadcomb1.php?P=a’,function(){

,function(){combo6.load(‘loadcomb6.php?X=e’,function(){form_1.load(“loadform.php?E=a”)}
);}

});

This way it seems to me (I have to check) work well.
What do you think about it ?
the approach you suggested allows you to write code more readable instead my code is really complex.

Thanks again for your help

this approach will also work, but it will required to add more code or remove existing code if you have to add say combo7 and combo8 or remove combo3 and combo4.

form have inner mechanism which ‘save’ value while combo not loaded and later fill it after data filled. here is a demo