title: Prevent or postpone commandLink action with yes/no dialog with primefaces
body: <p>In my UI there are items edited. In this edit UI the user can switch to the next or previous item. If the user has changed a value (saved in javascript) of the item I want to show a dialog which asks to save and offers the actions "yes", "no" and "cancel".</p>
  
  <p>Here is some example code for the next item link:</p>
  
  <pre><code>&lt;p:commandLink ajax="true" action="#{editPropertyBL.nextItem()}" onstart="handleDocNavigation();" process="@this" immediate="true" /&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre><code>function handleDocNavigation() {
      if (valueInEditChanged == true) {
          PF('valueChangedEditDialogVar').show();
      } 
  }
  
  
  &lt;p:dialog id="valueChangedEditDialogId" widgetVar="valueChangedEditDialogVar" modal="true"&gt;
  
      &lt;h:outputText value="Save changes?" /&gt;
  
      &lt;f:facet name="footer"&gt;
          &lt;h:panelGroup&gt;
              &lt;p:commandButton value="Yes" ...??? /&gt;
              &lt;p:commandButton value="No" ...??? /&gt;
              &lt;p:commandButton value="Cancel" oncomplete="PF('valueChangedEditDialogVar').hide(); return false;" /&gt;
          &lt;/h:panelGroup&gt;
      &lt;/f:facet&gt;
  </code></pre>
  
  <p>The call of editPropertyBL.nextItem() method shall be prevented when the users clicks "cancel" in the confirmation dialog that remains on the current "dirty" item.
  When the user clicks "yes" a save action must be invoked (from the confirmation dialog) and then switch to the next item. With "cancel" it is switched to the next item.</p>
  
  <p>Problem is when the modal confirmation dialog is coming up the item is switched before one of the three buttons of the dialog is clicked. I experimented with return false without success.
  Any idea how to do that? I think this is common requirement, but haven't found an example.
  I think primefaces confirmDialog is not suitable for my case.
  Probably remoteCommand could be a solution? I hope there is a more elegant way.</p>
  
  <p>Regards
  Oliver</p>