title: Primefaces How to show/hide inputText based on selected selectManyCheckbox items
body: <p>I need your assistance in showing and hiding <code>inputText</code> based on the selected items in the <code>selectManyCheckbox</code>in the xhtml. The code is:</p>
  
  <pre><code>&lt;p:selectManyCheckbox id="basic" value="#{user1.selectedConsoles}"&gt;
    &lt;f:selectItem itemLabel="Xbox One SS" itemValue="XboxOne" /&gt;
    &lt;f:selectItem itemLabel="PS4 SS" itemValue="PS4" /&gt;
    &lt;f:selectItem itemLabel="Wii U SS" itemValue="WiiU" /&gt;
    &lt;p:ajax listener="#{user1.renderInput}" update="name"/&gt;
  &lt;/p:selectManyCheckbox&gt;
  
   &lt;h:panelGroup id="name"&gt;
    &lt;p:inputText value="" rendered="#{user1.renderText}"/&gt;
   &lt;/h:panelGroup&gt;
  </code></pre>
  
  <p>And the bean code:</p>
  
  <pre><code>private String[] selectedConsoles; //Setter &amp; Getter
  private List&lt;String&gt; list = new ArrayList&lt;String&gt;(); //Setter &amp; Getter
  private boolean renderText = false; //Setter &amp; Getter
  
  
  public void renderInput() {
    list= Arrays.asList(selectedConsoles);
    if (list.contains("PS4")) {
      renderText = true;
    }
    else if (!list.contains("PS4")) {
          renderText = false;
    }
  }
  </code></pre>
  
  <p>If the <code>selectManyCheckbox</code> contains ("PS4"), then show the inputText, otherwise keep it hidden. Now in the above case, it is showing if I have selected <code>PS4</code>, but when I unckeck <code>PS4</code>, the inputText will remain in the form and will not be hidden.</p>