title: JSF onchange event
body: <p>I have a JSF application in which I have an combobox like this.</p>
  
  <pre><code>&lt;script type="text/javascript" defer="defer"&gt;
    &lt;!--//--&gt;&lt;![CDATA[//&gt;&lt;!--
      helpKey = 'APPLICATION_EDIT_DATASOURCE';
  
      function reapplyStyles() {}
  
      function selectT(data){
          if(data.status == "begin"){
              $('editForm:selectTypeButton').click();    
          }
      }
  
     //--&gt;&lt;!]]&gt;
  &lt;/script&gt;
  
    &lt;h:form id="editForm"&gt;
      &lt;h:inputHidden id="id" value="#{applicationObject.objectId}"/&gt;
      &lt;h:inputHidden id="type" value="#{applicationObject.object.type}"/&gt;
      &lt;h:inputHidden id="selectedDSForApp" value="#{applicationObject.selectedDataSourceId}"/&gt;
      &lt;ui:param name="activityDataSource" value="#{applicationObject.selectedDataSourceBean}"/&gt;
  
      &lt;a4j:outputPanel id="activityDataSourceRulesPanel"&gt;
      &lt;h:panelGrid columns="2" columnClasses="padded" rowClasses="padded"&gt;
  
        &lt;h:outputText value="#{msgs.transformation_rule}"/&gt;
        &lt;h:panelGroup&gt;
            &lt;h:selectOneMenu id="dsTransformationRule" value="#{activityDataSource.selectedTransformationRule}"
                             disabled="#{!sp:hasRight(facesContext, 'ManageApplication')}"
                             readonly="#{!sp:hasRight(facesContext, 'ManageApplication')}"&gt;
              &lt;f:selectItems value="#{activityDataSource.transformationRules}"/&gt;
            &lt;/h:selectOneMenu&gt;
            &lt;ui:fragment rendered="#{sp:hasRight(facesContext, 'ManageRules')}" &gt;
                &lt;input type="button" value="#{msgs.button_ellipsis}" class="ruleEditorBtn"
                       onclick="SailPoint.Rule.Editor.edit($('editForm:dsTransformationRule').value,
                               'ActivityTransformer',
                               $('editForm:refreshActivityDataSourceRulesButton'))" /&gt;
            &lt;/ui:fragment&gt;
        &lt;/h:panelGroup&gt;
  
        &lt;h:outputText value="#{msgs.correlation_rule}"/&gt;
        &lt;h:panelGroup&gt;
            &lt;h:selectOneMenu id="dsCorrelationRule" value="#{activityDataSource.selectedCorrelationRule}"
                             disabled="#{!sp:hasRight(facesContext, 'ManageApplication')}"
                             readonly="#{!sp:hasRight(facesContext, 'ManageApplication')}"&gt;
              &lt;f:selectItems value="#{activityDataSource.correlationRules}"/&gt;
            &lt;/h:selectOneMenu&gt;
            &lt;ui:fragment rendered="#{sp:hasRight(facesContext, 'ManageRules')}" &gt;
                &lt;input type="button" value="#{msgs.button_ellipsis}" class="ruleEditorBtn"
                       onclick="SailPoint.Rule.Editor.edit($('editForm:dsCorrelationRule').value,
                               'ActivityCorrelation',
                               $('editForm:refreshActivityDataSourceRulesButton'))" /&gt;
            &lt;/ui:fragment&gt;
        &lt;/h:panelGroup&gt;
  
        &lt;h:outputText value="#{msgs.activity_data_src_type}"/&gt;
        &lt;h:panelGroup&gt;
          &lt;a4j:outputPanel id="collectorSettings"&gt;
            &lt;h:selectOneMenu id="collectorType"
                             value="#{activityDataSource.object.type}"
                             rendered="#{empty activityDataSource.object.id}"
                             disabled="#{!sp:hasRight(facesContext, 'ManageApplication')}"
                             readonly="#{!sp:hasRight(facesContext, 'ManageApplication')}"&gt;
                            &lt;!--  onchange="$('editForm:selectTypeButton').click();"&gt; --&gt;
               &lt;f:ajax event="change" 
                      onevent="selectT"
                      execute="@this dsTransformationRule dsCorrelationRule"
                      render="dsTransformationRule dsCorrelationRule"
                      listener="#{activityDataSource.handleCollectorTypeChange}" /&gt;
              &lt;f:selectItem itemValue="" itemLabel="#{msgs.select_collector_type}"/&gt;
              &lt;f:selectItems value="#{activityDataSource.collectorTypes}"/&gt;
            &lt;/h:selectOneMenu&gt;
            &lt;h:selectOneMenu id="fixedCollectorType" value="#{empty activityDataSource.object.type ? 'None' : activityDataSource.object.type}"
                             rendered="#{not empty activityDataSource.object.id}"
                             disabled="true"
                             readonly="true"&gt;
              &lt;f:selectItem itemValue="#{empty activityDataSource.object.type ? 'None' : activityDataSource.object.type}"
                            itemLabel="#{empty activityDataSource.object.type ? msgs.none : activityDataSource.object.type}"/&gt;
            &lt;/h:selectOneMenu&gt;
          &lt;/a4j:outputPanel&gt;
        &lt;/h:panelGroup&gt;
      &lt;/h:panelGrid&gt;
      &lt;/a4j:outputPanel&gt;
  
      &lt;a4j:outputPanel id="configSettings"&gt;
        &lt;h:messages infoClass="formInfo" warnClass="formWarn" errorClass="formError" fatalClass="formError"/&gt;
  
        &lt;h:panelGroup  rendered="#{not empty activityDataSource.object.collector}"&gt;
          &lt;ui:include src="#{activityDataSource.configPage}"/&gt;
        &lt;/h:panelGroup&gt;
      &lt;/a4j:outputPanel&gt;
      &lt;h:panelGroup&gt;
        &lt;div class="buttonRow"&gt;
          &lt;ui:fragment rendered="#{sp:hasRight(facesContext, 'ManageApplication')}"&gt;
            &lt;h:commandButton id="activityDataSourceSave" action="#{activityDataSource.saveAction}" value="#{msgs.button_save}" styleClass="primaryBtn"/&gt;
          &lt;/ui:fragment&gt;
          &lt;h:commandButton id="activityDataSourceCancel" action="#{activityDataSource.cancelAction}" value="#{msgs.button_cancel}" styleClass="secondaryBtn"/&gt;
        &lt;/div&gt;
      &lt;/h:panelGroup&gt;
  
      &lt;a4j:commandButton id="refreshActivityDataSourceRulesButton"
                         style="display:none"
                         immediate="true"
                         render="activityDataSourceRulesPanel"/&gt;
  
      &lt;a4j:commandButton id="selectTypeButton" action="#{activityDataSource.selectType}" style="display:none"
                         render="configSettings, collectorSettings"
                         oncomplete="initializeSelectedConfigPage();"/&gt;
  
    &lt;/h:form&gt;
  </code></pre>
  
  <p>Bean Class</p>
  
  <pre><code>public String getSelectedTransformationRule() {
      if (_selectedTransformationRule == null) {
          ActivityDataSourceDTO dto = getObject();
          if (dto != null)
              _selectedTransformationRule = dto.getTransformationRule();
      }
  
      return _selectedTransformationRule;
  }
  public String getSelectedCorrelationRule() {
      if (_selectedCorrelationRule == null) {
          ActivityDataSourceDTO dto = getObject();
          if (dto != null)
              _selectedCorrelationRule = dto.getCorrelationRule();
      }
  
      return _selectedCorrelationRule;
  }
  </code></pre>
  
  <p>In the above code I have a normal onchange event &amp; an ajax onchange event on combobox element id= collectorType.</p>
  
  <p>Is there any limitation in using two change for same element in JSF.</p>
  
  <p>Also how can I merge first onchange to ajax onchange.</p>