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

combo box with check box

0 Answers 34 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kalyani
Top achievements
Rank 1
Kalyani asked on 22 Sep 2014, 07:30 PM
I am trying to write a javascript code.  This is code I have right now.

<script type='text/javascript'>
function onCheckBoxClickctl00_Content_ddc1_CB1(){
var combo=$find('ctl00_Content_ddc1_CB1');
 var CountChecked=0;
var text='This is the text message';
var max ='4';
var items = combo.get_items();
for(var i=0;i<items.get_count();i++){
var item=items.getItem(i);
var chk1=$get(combo.get_id()+'_i'+i+'_chk1');
if(chk1.checked){
CountChecked ++;
if(max < CountChecked) {
chk1.checked = false;
}
text+=item.get_text()+',';
 if(CountChecked > 3)
{ text = 'You have ' + CountChecked  + ' items selected :';}
}
}
 text=removeLastDelimiter(text);
if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}
</script>

if(text.length>0){combo.set_text(text);}else{combo.set_text('');}}

I would like to write the text in the first line of the drop down.  Something like items._array[0].set_text(text).  But when I did this I get an error.  Can you please tell me how to do this.

Thank you

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
Kalyani
Top achievements
Rank 1
Share this question
or