combo box with check box

1 posts, 0 answers
  1. Kalyani
    Kalyani avatar
    20 posts
    Member since:
    Jul 2011

    Posted 22 Sep 2014 Link to this post

    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
Back to Top