title: Radio buttons using twitter bootstrap - unable to get value
body: <p>I've browsed SO, and found some answers that have guided me closer to getting working radio buttons, but I'm stuck now. </p>
  
  <p>I have the buttons, but am unable to get the value of the selected one.</p>
  
  <p>I'm using JSF, hence the <code>#{searchFlightsBean.setDir()}</code></p>
  
  <p>Here's what I currently have:</p>
  
  <pre><code>&lt;h:panelGrid&gt;
      &lt;div class="btn-group" data-toggle-name="is_private" data-toggle="buttons-radio" &gt;
          &lt;button type="button" value="0" class="btn" data-toggle="button"&gt;Public&lt;/button&gt;
          &lt;button type="button" value="1" class="btn" data-toggle="button"&gt;Private&lt;/button&gt;
      &lt;/div&gt;
      &lt;h:inputHidden id="hiddenDir" value="0" valueChangeListener="#{searchFlightsBean.setDir()}"  onchange="submit()"/&gt;
  &lt;/h:panelGrid&gt;
  
  &lt;script&gt;
  $(function() {
      $('div.btn-group[data-toggle-name]').each(function() {
          var group = $(this);
          var form = group.parents('form').eq(0);
          var name = group.attr('data-toggle-name');
          var hidden = $('input[name="' + name + '"]', form);
          $('button', group).each(function() {
              var button = $(this);
              button.on('click', function() {
                  hidden.val($(this).val());
              });
              if (button.val() == hidden.val()) {
                  button.addClass('active');
                  #{searchFlightsBean.setDir(button.value)}
              }
          });
      });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>In my bean, when <code>setDir()</code> is called, I am logging the value that it receives, like so:</p>
  
  <pre><code>public void setDir(ValueChangeEvent e) {
      this.dir = e.getNewValue().toString();
      log.info("NEW DIRECTION: " + this.getDir());
  }
  </code></pre>
  
  <p>It doesn't log - <code>setDir()</code> is never called. For some reason the <code>valueChangeListener</code> attribute on the <code>h:inputHidden</code> tag doesn't work. Am I missing something?</p>