title: Show drop down box with values when select value from another dropdown
body: <p>I need to show a new drop down box upon selecting a value from another drop down box which is already available in the page. First drop down is already available in the page and second will be hidden based on boolean value I am getting from Bean class.</p>
  
  <p>The problem is the hidden drop down is not visible until I refresh the page. When I refresh the page, then only I can see the hidden drop down box. When I unselect another value from first drop down box, the second dropdown should be hidden which is also happening, but I have to refresh the page.</p>
  
  <p>See my code below for reference:</p>
  
  <p><code>instrumentDetails.xhtml</code></p>
  
  <pre><code>&lt;!-- First drop down --&gt;
          &lt;h:outputText id="product_Group"
              value="#{msg.instrument_add_edit_product_group}" escape="false" /&gt;
          &lt;a4j:region&gt;
              &lt;h:selectOneMenu
                  value="#{instrumentBean.instrumentData.productGroupId}"
                  valueChangeListener="#{instrumentBean.populateProductTypeByServiceProvider}"
                  style="width:140px" styleClass="dropDown"&gt;
                  &lt;f:selectItem itemValue="0"
                      itemLabel="#{msg['gobal.select.default.label']}" /&gt;
                  &lt;f:selectItems var="productGroupItem"
                      itemValue="#{productGroupItem.id}"
                      itemLabel="#{productGroupItem.label}"
                      value="#{referenceMaster.productGroupLabelKeyList}" /&gt;
                  &lt;a4j:ajax event="valueChange"   render="productTypeListInstrument,servList,showServiceId"
                      execute="@this" /&gt;
              &lt;/h:selectOneMenu&gt;
          &lt;/a4j:region&gt;
  
  &lt;!-- Second drop down --&gt;       
  &lt;a4j:outputPanel ajaxRendered="true" id ="showServiceId" rendered="#{instrumentBean.showService}"&gt;
          &lt;h:outputText id="serviceId" value="#{msg.instrument_add_edit_service}"
              escape="false" /&gt;
          &lt;h:selectOneMenu value="#{instrumentBean.instrumentData.service}"
              style="width:140px" styleClass="dropDown" &gt;
              &lt;f:selectItem itemValue="0" itemLabel="Mobile" /&gt;
              &lt;f:selectItem itemValue="1" itemLabel="Telephone" /&gt;
              &lt;f:selectItem itemValue="2" itemLabel="ISDN BRI" /&gt;
          &lt;/h:selectOneMenu&gt;
      &lt;/a4j:outputPanel&gt;
  </code></pre>
  
  <p><code>InstrumentBean.java</code></p>
  
  <pre><code>private boolean showService;
  
      public void populateProductTypeByServiceProvider(ValueChangeEvent event) {
          try {
              Integer rowindex = new Integer(event.getNewValue().toString());
              if (!CommonUtil.isBlankInteger(instrumentData
                      .getServiceProviderId())
                      &amp;&amp; !CommonUtil.isBlankInteger(rowindex)) {
  
                  int productGroupId = rowindex.intValue();
  
                  List&lt;LabelKeyTO&gt; labelKeyTOList = findProductsByGroupAndServiceProvider(
                          productGroupId, instrumentData.getServiceProviderId());
  
                  Collections.sort(labelKeyTOList);
                  this.productTypeDetailList = labelKeyTOList;
                  setDefaultDetailsListSerRate();
                  defaultServiceTable();
  
              } else {
                  if (CommonUtil.isBlankInteger(instrumentData
                          .getServiceProviderId())) {
                      this.instrumentData.setProductGroupId(0);
                  }
                  this.instrumentData.setProductTypeId(0);
                  setDefaultDetailsListProdSerRate();
                  defaultServiceTable();
              }
  
              if(rowindex == 1){
                  showService = true;
              }else if(rowindex == 2){
                  showService = true;
              }else{
                  showService = false;
              }
  
  
  
          } catch (Exception e) {
              this.instrumentData.setProductTypeId(0);
              setDefaultDetailsListProdSerRate();
              defaultServiceTable();
              String reasonFailure = e.getMessage();
              validationMessage(reasonFailure, reasonFailure, reasonFailure,
                      FacesMessage.SEVERITY_ERROR);
          }
      }
  </code></pre>