title: Ajax change event listener not firing for second time
body: <p>I'm using JSF-2.1 with PrimeFaces 4.0, and trying to implement partial submit on a drop down which populates another dropdown based on value selected.
  The ajax change event fires on changing the ip from "select" to some ip for first time and populates dstn dropdown, but when I change the ip for second time the event is not fired.  </p>
  
  <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:p="http://primefaces.org/ui"&gt;
      &lt;f:view contentType="text/html"&gt;
          &lt;h:head&gt;
          &lt;/h:head&gt;
      &lt;h:body&gt;
      &lt;h:form&gt;
                          &lt;p:messages id="validations" /&gt;
      &lt;h:outputLabel for="ip" value="Source:"&gt;&lt;/h:outputLabel&gt;
                              &lt;p:selectManyMenu id="ip" value="#{inputBean.ip}"
                                  required="true" requiredMessage="Enter Source"&gt;
                                  &lt;f:selectItems value="#{inputBean.ipMenu}" /&gt;
                                  &lt;p:ajax listener="#{inputBean.populateDstn}" event="change" 
                                      update="dstn" process="@this" partialSubmit="true"/&gt;
                              &lt;/p:selectManyMenu&gt;
                              &lt;h:outputLabel for="dstn" value="Destination:"&gt;&lt;/h:outputLabel&gt;
                              &lt;p:selectManyMenu id="dstn" value="#{inputBean.dstn}"
                                  required="true" requiredMessage="Enter Destination"&gt;
                                  &lt;f:selectItems value="#{inputBean.dstnMenu}" /&gt;
                              &lt;/p:selectManyMenu&gt;
      &lt;/h:form&gt;
      &lt;/h:body&gt;
      &lt;/f:view&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p><strong>Backing bean</strong></p>
  
  <pre><code> @ManagedBean
      @ViewScoped
  
      public class InputBean implements Serializable
      {
      private static final long serialVersionUID = 1L;
          private List&lt;Long&gt; ip;
          private Map&lt;String, Long&gt; ipMenu;
          private List&lt;Long&gt; dstn;
          private Map&lt;String, Long&gt; dstnMenu;
          @ManagedProperty("#{dataBase}")
      private transient DataBase db;
  
          private StringBuilder query;
  
  
      @PostConstruct
          public void init()
          {
      ipMenu.put("Select", null);
              dstnMenu.put("Select", null);
      try
              {
  Connection connection = null;
              ResultSet rs = null;
              PreparedStatement pst_query = null;
                          query.setLength(0);
                  connection = db.getConnection();
                  query.append("SELECT DISTINCT IPADDRESS FROM ADDR ORDER BY IPADDRESS ");
                  pst_query = connection.prepareStatement(query.toString());
                  rs = pst_query.executeQuery();
                  while (rs.next())
                  {
                      ipMenu.put(rs.getLong("IPADDRESS")), rs.getLong("IPADDRESS"));
  
                  }
                  rs.close();
                  query.setLength(0);
                  pst_query.close();
                  connection.close();
              }
              catch (SQLException e)
              {
                  e.printStackTrace();
              }
      }
      //getters and setters
  
      public void populateDstn()
          {
              System.out.println("ipaddr : " + this.ip);
              try
              {
                  dstnMenu.clear();
  Connection connection = null;
          ResultSet rs = null;
          PreparedStatement pst_query = null;
                  connection = db.getConnection();
                  for (int i = 0; i &lt; ip.size(); i++)
                  {
                  query.append("SELECT DISTINCT DSTN FROM ADDR " + "WHERE IPADDRESS= '" + this.ip.get(i) + "'  ORDER BY DSTN ");
                  pst_query = connection.prepareStatement(query.toString());
                  rs = pst_query.executeQuery();
                  while (rs.next())
                  {
                      dstnMenu.put(rs.getLong("DSTN"), rs.getLong("DSTN"));
                  }
                  rs.close();
                  query.setLength(0);
                  pst_query.close();
                  connection.close();
                  }
              }
              catch (SQLException e)
              {
                  FacesContext.getCurrentInstance().addMessage("tableplot:validations", new FacesMessage("Problem fetching Destinations"));
                  e.printStackTrace();
              }
  
          }
      }
  </code></pre>
  
  <p><strong>Error</strong>  </p>
  
  <pre><code>Uncaught ReferenceError: cfgx is not defined primefaces.js.xhtml?ln=primefaces:1
      PrimeFaces.createWidget primefaces.js.xhtml?ln=primefaces:1
      PrimeFaces.cw primefaces.js.xhtml?ln=primefaces:1
      (anonymous function)
      (anonymous function) jquery.js.xhtml?ln=primefaces:14
      bG.extend.globalEval jquery.js.xhtml?ln=primefaces:14
      (anonymous function) jquery.js.xhtml?ln=primefaces:21
      bG.extend.each jquery.js.xhtml?ln=primefaces:14
      bG.fn.extend.domManip jquery.js.xhtml?ln=primefaces:21
      bG.fn.extend.append jquery.js.xhtml?ln=primefaces:21
      (anonymous function) jquery.js.xhtml?ln=primefaces:21
      bG.extend.each jquery.js.xhtml?ln=primefaces:14
      bG.fn.bG.each jquery.js.xhtml?ln=primefaces:14
      bG.fn.extend.replaceWith jquery.js.xhtml?ln=primefaces:21
      PrimeFaces.ajax.AjaxUtils.updateElement primefaces.js.xhtml?ln=primefaces:1
      PrimeFaces.ajax.AjaxResponse primefaces.js.xhtml?ln=primefaces:1
      (anonymous function) primefaces.js.xhtml?ln=primefaces:1
      bZ jquery.js.xhtml?ln=primefaces:14
      b7.fireWith jquery.js.xhtml?ln=primefaces:14
      ca jquery.js.xhtml?ln=primefaces:21
      bZ jquery.js.xhtml?ln=primefaces:21
  </code></pre>