How to take the value of a combo by name?

My combos are generated. Ex; : comboName1, comboName2, etc.
And they are used after by other scripts.
How to take the value of a combo by name ?

Hello
If you mean than you have array of combos and you need to get all the values, you can just iterate your array via method getActualValue()
I.e.:

var combos = [...]; var actualValues = []; for (var i=0; i<combos.length; i++){ actualValues = actualValues .push(combos[i].getActualValue()) }

Unfortunately, I don’t have array of combos.

So, haw many combos do you have and how you init them?

The number of combos is selected by user.

The (horrible) code:

... for(jj=0;jj<window.dialogArguments.length;jj++) { nlignes = jj; var code_js_listes_ajax = 'var comboLibelleDA'+nlignes+' = new dhtmlXCombo("libCim10_'+nlignes+'", "libCim10_'+nlignes+'", 1000);'+ 'var comboCodeDA'+nlignes+' = new dhtmlXCombo("liste_das_saisie_'+nlignes+'", "liste_das_saisie_'+nlignes+'", 100);'+ 'customizeDA_code(comboCodeDA'+nlignes+', comboLibelleDA'+nlignes+');'+ 'customizeDA_libelle(comboLibelleDA'+nlignes+', comboCodeDA'+nlignes+');'; addCode(code_js_listes_ajax); } ... function addCode(code){ var JS= document.createElement('script'); JS.text= code; document.getElementById('appendDiv').appendChild(JS); }

Hi

you can save combos into an array while adding with your script also you can extend your script:

[code]for(jj=0;jj<window.dialogArguments.length;jj++)
{
nlignes = jj;
var code_js_listes_ajax =
‘var comboLibelleDA’+nlignes+’ = new dhtmlXCombo(“libCim10_’+nlignes+’”, “libCim10_’+nlignes+’”, 1000);’+
‘var comboCodeDA’+nlignes+’ = new dhtmlXCombo(“liste_das_saisie_’+nlignes+’”, “liste_das_saisie_’+nlignes+’”, 100);’+
‘customizeDA_code(comboCodeDA’+nlignes+’, comboLibelleDA’+nlignes+’);’+
‘customizeDA_libelle(comboLibelleDA’+nlignes+’, comboCodeDA’+nlignes+’);’;
addCode(code_js_listes_ajax);
}

var code_js_get_values = ‘function getActialValues(){var values=[];’;
for(jj=0;jj<window.dialogArguments.length;jj++)
{
nlignes = jj;
code_js_get_values += ‘values.push(comboLibelleDA’+nlignes+’.getActialValue());’+
code_js_get_values += ‘values.push(comboCodeDA’+nlignes+’.getActialValue());’;
}
code_js_get_values += ‘return values;}’;
addCode(code_js_get_values);[/code]

anyway I strongly recommend you to white js code on a client side without generating it on server, this is very bad practice. if you need more help or tips or would like to hire team - please contact our sales dept ad sales@dhtmlx.com, save your money and time :wink:

I added an array.
Thank you.