title: How to get selected icefaces datatable row using radiobutton?
body: <p>How can I select a row in icefaces datatable using radio button?</p>
  
  <p>I tried with the following</p>
  
  <pre><code>&lt;h:selectOneRadio styleClass="none" valueChangeListener="#{bean.setSelectedItem}"
                  onclick="dataTableSelectOneRadio(this);"&gt;
                  &lt;f:selectItem itemValue="null" /&gt;
              &lt;/h:selectOneRadio&gt;
  </code></pre>
  
  <p>And my javascript</p>
  
  <pre><code>function dataTableSelectOneRadio(radio) {
      var id = radio.name.substring(radio.name.lastIndexOf(':'));
      var el = radio.form.elements;
      for (var i = 0; i &lt; el.length; i++) {
          if (el[i].name.substring(el[i].name.lastIndexOf(':')) == id) {
              el[i].checked = false;
          }
      }
      radio.checked = true;
  }
  </code></pre>
  
  <p>In another post I got an answer that I should replace form.name with form.id. However after that I am getting error</p>
  
  <pre><code>radio.form is undefined 
  var elements = radio.form.elements;
  </code></pre>
  
  <p>Could someone help me how to resolve this issue.</p>
  
  <p>I would like to select one row in icefaces datatable using radio button.</p>
  
  <p>Any help is highly appreciable.</p>
  
  <p>Thanks</p>
  
  <p>Posting my generated html source</p>
  
  <p>See here is jsf code for radio button</p>
  
  <pre><code>&lt;h:selectOneRadio  valueChangeListener="#{bean.setSelectedItem}"
  id="reqselect" onclick="dataTableSelectOneRadio(this);"&gt;
  &lt;f:selectItem itemValue="null" /&gt;
  &lt;/h:selectOneRadio&gt;
  </code></pre>
  
  <p>My heartfelt apologies for posting in correct html source, I was testing some thing else and thus wrong source got posted. Pasted below is my correct html source, kindly see if you could find something.
  </p>