title: Clicking p:commandButton causes the value of p:selectOneMenu being set twice
body: <p>I ran into an issue with PrimeFaces - consider form with <code>SelectOneMenu</code> being put inside of <code>Inplace</code>. Next to the Inplace we have a <code>CommandButton</code> that is meant to reset the value of the <code>SelectOneMenu</code>.</p>
  
  <p>The form looks like this:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;h:form id="myform"&gt;
      &lt;p:inplace id="inplace" editor="true"&gt;
          &lt;p:ajax event="save" update="@(form)" /&gt;
  
          &lt;f:facet name="output"&gt;
              &lt;h:outputText value="#{testBean.year}" /&gt;
          &lt;/f:facet&gt;
  
          &lt;f:facet name="input"&gt;
              &lt;p:selectOneMenu id="selYears" value="#{testBean.year}"&gt;
                  &lt;f:selectItem itemValue="2015" itemLabel="2015" /&gt;
                  &lt;f:selectItem itemValue="2014" itemLabel="2014" /&gt;
                  &lt;f:selectItem itemValue="2013" itemLabel="2013" /&gt;
              &lt;/p:selectOneMenu&gt;
          &lt;/f:facet&gt;
      &lt;/p:inplace&gt;
  
      &lt;p:commandButton id="btnResetYear" value="Reset year" rendered="#{testBean.year lt 2015}"
          action="#{testBean.resetYear()}" update="@(form)" /&gt;
  
  &lt;/h:form&gt;
  </code></pre>
  
  <p>This is the TestBean:</p>
  
  <pre><code>import javax.annotation.PostConstruct;
  import javax.faces.bean.ManagedBean;
  import javax.faces.bean.ViewScoped;
  
  @ManagedBean
  @ViewScoped
  public class TestBean {
      private int year;
  
      @PostConstruct
      private void init() {
          this.year = 2015;
      }
  
      public int getYear() {
          return year;
      }
  
      public void setYear(int year) {
          System.out.println("---&gt; setYear: " + year);
          this.year = year;
          this.someMethod();
      }
  
      public void someMethod() {
          System.out.println("---&gt; someMethod: " + this.year);
      }
  
      public void resetYear() {
          System.out.println("---&gt; resetYear");
          this.setYear(2015);
      }
  }
  </code></pre>
  
  <p>The following scenario works just fine:</p>
  
  <ol>
  <li>Click the year to show the actual <code>SelectOneMenu</code></li>
  <li>Select different year (e.g. 2013)</li>
  <li>Confirm the selection by clicking the "check" button</li>
  </ol>
  
  <p>However, if I try clicking the "Reset year" button, the method <code>setYear</code> is called with the original year as a parameter just before <code>resetYear</code> is called. This is what I can see in a console:</p>
  
  <pre><code>12:28:40,003 INFO  [stdout] (default task-15) ---&gt; setYear: 2013
  12:28:40,003 INFO  [stdout] (default task-15) ---&gt; someMethod: 2013
  12:28:40,004 INFO  [stdout] (default task-15) ---&gt; resetYear
  12:28:40,004 INFO  [stdout] (default task-15) ---&gt; setYear: 2015
  12:28:40,004 INFO  [stdout] (default task-15) ---&gt; someMethod: 2015
  </code></pre>
  
  <p>Which is what I do not want as <code>someMethod</code> is intended to e.g. load data from DB and there is no reason to run it for the original value and then for the new value again.</p>
  
  <p>If I use the standard <code>CommandButton</code> instead of the one provided by PrimeFaces, it seems to work properly:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;h:commandButton id="btnResetYear" value="Reset year" rendered="#{testBean.year lt 2015}"&gt;
      &lt;f:ajax listener="#{testBean.resetYear}" render="myform" /&gt;
  &lt;/h:commandButton&gt;
  </code></pre>
  
  <p>Clicking the standard button would give the expected result:</p>
  
  <pre><code>12:42:11,506 INFO  [stdout] (default task-88) ---&gt; resetYear
  12:42:11,506 INFO  [stdout] (default task-88) ---&gt; setYear: 2015
  12:42:11,506 INFO  [stdout] (default task-88) ---&gt; someMethod: 2015
  </code></pre>
  
  <p><strong>QUESTION:</strong></p>
  
  <p>Is this a bug in PrimeFaces or did I do anything wrong? Is there a way to setup the PF's CommandButton to behave like described above, i.e. not to trigger the <code>setYear</code> method with old parameter passed in or do I have to stick with the "standard" <code>CommandButton</code>?</p>
  
  <p>I was experimenting with setting <code>immediate="true"</code> to the <code>CommandButton</code> and it indeed skipped setting the original value first, but the <code>SelectOneMenu</code> didn't take the new value into account, no matter what I put into the button's <code>update</code> attribute - it was still showing the original value.</p>
  
  <p>The example was run using the following:</p>
  
  <ul>
  <li>Java 1.8 (jdk1.8.0_51 - 64bit)</li>
  <li>PrimeFaces 5.2</li>
  <li>WildFly 8.2.0 (also tested with JBoss 7.1)</li>
  </ul>
  
  <p>Any idea is more than welcome.</p>