I click the Button "save" and then push Enter on the focused InputText. Now my other Dialog opens. When the InputText got no focus, pressing Enter wont open the other dialog. Why is that happening?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<h:form>
<!-- BUTTONS -->
<p:commandButton
id="defineXmlButton"
value="define"
oncomplete="PF('dialogTxParams').show();"
update="dialogTxParams" />
<p:commandButton
id="openSaveChainDialogButton"
value="save"
ajax="true"
onclick="PF('saveChainDialog').show();"
/>
<!-- DIALOGS -->
<p:dialog header="Save Dialog" widgetVar="saveChainDialog"
id="saveChainDialog" modal="true" resizable="false"
closeOnEscape="true">
<h:panelGrid columns="3" cellpadding="5" cellspacing="0">
<p:outputLabel for="chainname">Name</p:outputLabel>
<p:inputText id="chainname" value=""></p:inputText>
<p:commandButton
id="saveChainButton"
value="OK"
actionListener="#{chainController.saveChain()}"
ajax="true"
oncomplete="PF('saveChainDialog').hide();"
update="saveChainDialog">
</p:commandButton>
</h:panelGrid>
</p:dialog>
<p:dialog
header="#{txWfSenderModel.selectedWf.description}"
id="dialogTxParams"
widgetVar="dialogTxParams"
modal="false"
resizable="false"
dynamic="true"
fitViewport="true"
closeOnEscape="true">
</p:dialog>
</h:form>
</h:body>
</html>
Edit:
Kukeltje led to another question, which helped me to find a solution. See the comments. I solved the problem by using an own <h:form>
tag for each dialog, so the default button is correct.