How do I get the combobox object once declared?

Once I declare it, how do I get it later on when I want to use it again in an event. For instancee when it changes and finding out if they selected a certain value in order ot show more inputs.

I can think of a clouge which is to declare globally variables for each combobox when they are intialized.

However, that would be quit tough to do in a dynamic scenario when comboboxes are used with grids and people editing mulltiple lines at once before saving.

Thanks,

Angela

yourCombo = new dhtmlXCombo(…);

In this example yourCombo can be used to apply dhtmlXCombo methods.

Hi Alexandra,

Thanks for your response, however, I do not believe that is what I want.

The combobox has already been declared in a pageload javascript event.

Now I want to access it again by name. I do NOT want to create/initialize it again.

I also do not I wish to try to develop global variables for each combobox when they are intialized.

How can I get access?

IE. Get access to HTML elements you do document.getElementById();
Get access to JQuery/HTML elements you do $(#);

Your answer means I would be creating a new object that would initialize the combobox.
yourCombo = new dhtmlXCombo(…);

One piece of information I forgot to say I am also using Select Box creation which doesn’t use the new.

Funny thing is if I do a getElementById by the original Id before conversion… After conversion that object is deleted and it returns a null.

Thansk for you help

Hi,

In case of initiationalizaion based in select you should use the simialar approach:

yourCombo = dhtmlXComboFromSelect(…);

dhtmlXComboFromSelect() function returns combo object

Funny thing is if I do a getElementById by the original Id before conversion… After conversion that object is deleted and it returns a null.

It is correct. Combo removes html select and creates other html elements.

This didn’t work for me.

What i had to do was develop a dictionary table in javqascript and after each combobox declarations I put it in the dictionary with it’s name and reference to the cb object.

Global JS
var ComboList = new Array();

Initializing the combo
yourCombo = dhtmlXComboFromSelect(…);
ComboList[“mycomboid”] = yourCombo;

Later for use
function myfunc(){
if (ComboList[“mycomboid”].getSelectedValue() == “324”) {
<< show my div>>
}
}

Have a good one, Angela