title: Can we create a dialog box with a checkbox and a combobox using google closure
body: <p>I am trying to create a dialog box with a checkbox, a user name and a combobox for roles which is enabled only when the checkbox is checked. I have the basic code running on a jsp page but how do i get it to work in a dialog box? All the components are rendered using google closure.</p>
  
  <p>my js file</p>
  
  <pre><code>function combox ()
      {
      goog.events.listen((goog.dom.getElement('switch')), goog.events.EventType.CLICK,
              function(e) {
              var request = new goog.net.XhrIo();
              var cb = new Array();
         goog.events.listen(request, "complete", function(e){
          var xhr = /** @type {goog.net.XhrIo} */ (e.target);
          res = xhr.getResponseJson();
          var mycount = count(res.myrole);
          var content = new Array();
              var userlist = new Array();
              for(var k=0;k&lt;mycount;k++)
              {
                  content[k] = res.myrole[k].role;
              }
              var mycount1 = count(res.myusers);
              for(var l=0;l&lt;mycount;l++)
              {
                  userlist[l] = res.myusers[l].user;
              }
              var child = new Array();
              var container = goog.dom.getElement('c'); 
              for(var m=0;m&lt;userlist.length;m++)
              {
                child[m] = goog.dom.createDom('div',{'id':'user'+(m+1)},userlist[m]);
                cb[m] = new goog.ui.ComboBox();
                cb[m].setUseDropdownArrow(true);
              for(var n=0;n&lt;content.length;n++)
              {
                cb[m].addItem(new goog.ui.ComboBoxItem(content[n]));;
              }
              cb[m].render();
              goog.dom.append(container, child[m]);
      });
      });
  }
  function count(obj) {
     var count=0;
     for(var user in obj) {
        if (obj.hasOwnProperty(user)) {
           ++count;
        }
     }
     return count;
  }
  </code></pre>
  
  <p>I'm getting proper response from my servlet, but I want these components in a dialog box(i.e a checkbox,username and a combobox for each user retrieved from my servlet.)</p>