This is a migrated thread and some comments may be shown as answers.

How do I get combobox type in javascript

1 Answer 72 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 06 Jul 2012, 09:59 PM
I have a switch statement in a javascript function that performs different actions based on the type of control that is being passed, however the sender.type of the RadComboBox is null. How do I get the type?

here is my javascript function:

function RefreshCsiOptions(sender) {
            switch (sender.type) {
                case "radio":
                    if (sender.checked == true) {
                        for (i = 0; i < cbxCSI.length; i++) {
                            var z = rcbCSI[i];
                            if (rcbCSI[i].get_selecteditem().get_value() != "") { rcbCSI[i].disabled = "disabled"; } else { cbxCSI[i].disabled = true; }
                            cbxCSI[i].checked = false;
                        }
                        lblWithoutCSI.disabled = "";
                    }
                    break;
                case "checkbox":
                    var cbxNumber = sender.id.substr(6, 1);
                    if (sender.checked == true) {
                        rcbCSI[cbxNumber - 1].disabled = "";
                        lblWithoutCSI.disabled = "disabled";
                        rbWITHOUT.checked = false;
                    } else {
                        rcbCSI[cbxNumber - 1].disabled = "disabled";
                    }
                    CheckWithoutStatus();
                    break;
                case "select-one":
                    var rcbNumber = sender.id.substr(14, 1);
                    if (rcbNumber == "_") rcbNumber = "0";
                    var rcbValue = rcbCSI[rcbNumber].get_selecteditem().get_value();
                    document.Form1.elements['CSI' + rcbNumber + '_value'].value = rcbValue;
                    if (rcbValue != "") {
                        cbxCSI[rcbNumber].disabled = false;
                        cbxCSI[rcbNumber].checked = true;
                        if (rbWITHOUT.checked == true) rbWITHOUT.checked = false;
                    } else {
                        cbxCSI[rcbNumber].disabled = true;
                        cbxCSI[rcbNumber].checked = false;
                        CheckWithoutStatus();
                    }
                    break;
                default:
                    //alert(sender.type);
                    break;
            }
        }  

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 09 Jul 2012, 03:52 PM
Hi Matthew,

Could you please send us more information regarding the exact your scenario?
Where do you call the RefreshCsiOptions function?
Could you please send us a complete sample to examine it locally?

Greetings,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Matthew
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Share this question
or