combo in form load errors?

I have a form with 4 combo items which get their values from MySQL using the combo_connector.php and render_table method. They are all lookup values which convert a numeric value in the source data to a text value in the lookup (eg departments 1,2,3,4 are shown as sales, marking, legal, production).

The combos all get populated with the correct values but the actual value shown in the form is sometimes the correct text item from the combo and other times the numercial value.

Typically (but not always) the values are correct when I load the form the fist time but if I reload it or change the record that the form is showing then the initial values in the combos show a mix of text or numeric. The combos that show correctly/incorrectly vary so I was wondering if it is some kind of caching / ajax timing issue?

I have tried this with Chrome, FF and IE and they all show the same symptoms so I dont think it is a browser problem.

Many thanks,
Paul

Try to set form data after combo xml are loaded. You may set onXLE event handler for combos (getCombo(name) returns combo object by an item name):

var combo = form.getCombo(comboName);
combo.attachEvent(“onXLE”, function(){
form.setItemValue(comboName,1);
});

Thanks Alexandra

I have created a generic function to set a combo value using -

   function setCombo(combo) {
                combo.attachEvent("onXLE", function(){
                        this.setComboValue(this.getActualValue());
                });
    }

this seems to work in Chrome and IE although it is still confusing why the combos are populated inconsistently each time the form is refreshed.

Paul