Below is the code I have for a ComboBox with a checklist:
<sq8:ComboBox runat="server" ID="ComboBox1" CheckBoxes="True" CheckedItemsTexts="DisplayAllInInput" Width="340px" OnClientItemChecked="ShowAlert"><Items>
<sq8:ComboBoxItem runat="server" Value="Yes" Text="Yes"></sq8:ComboBoxItem>
<sq8:ComboBoxItem runat="server" Value="No" Text="No"></sq8:ComboBoxItem>
<sq8:ComboBoxItem runat="server" Value="Maybe" Text="Maybe"></sq8:ComboBoxItem>
</Items>
</sq8:ComboBox>
<sq:BindableControl runat="server" TargetControlID="ComboBox1" DataField="ComboBox1"></sq:BindableControl>
This is the JavaScript function I am using to display the checked items in an alert:
<script type="text/javascript>
function ShowAlert() {
var combobox = $findByControlId("ComboBox1").get_checkedItems();
alert(combobox);
}
</script>
When I test this, the alert displays the values as:
[object Object]
I attempted to fix this by adding ".ToString" at the end of the alert:
alert(combobox.ToString);
However, this changed the checked items to "undefined" rather than displaying "[object Object]". I am unsure what to do next. Could someone provide assistance? The datatype for the ComboBox in my data model is String. Do I need to change it?
Thank you!