But I've read in the manual (primefaces 3.3), this is not possible if there is a inputText field on dialog form.
Following code opens a dialog but it can't be closed on escape.
If p:inputText is omitted, close on escape works fine.
Is there a workaround to have it work with inputText fields too?
Code: Select all
<h:form id="frmTest" prependId="false">
<p:commandLink
value="open dialog"
oncomplete="dialogWidget1.show()"
actionListener="#{jsfController.preAction1}"
update=":frmDialog1"/>
</h:form>
<p:dialog id="dialog1" widgetVar="dialogWidget1" modal="true" resizable="false">
<h:form id="frmDialog1">
<p:hotkey bind="esc" handler="dialogWidget1.hide()"/>
<h:panelGrid id="pnlDialog1" styleClass="panelGridNoBorder">
<p:row>
<h:outputLabel for="firstname" value="input field: "/>
<p:inputText value="#{jsfController.firstname}"
id="firstname" required="true"/>
</p:row>
<f:facet name="footer">
<p:commandButton value="execute"
update=":frmTest, :frmDialog1"
actionListener="#{jsfController.action1}"
oncomplete="handleDialog1(xhr, status, args)"/>
</f:facet>
</h:panelGrid>
</h:form>
</p:dialog>
<script type="text/javascript">
function handleDialog1(xhr, status, args) {
if(args.validationFailed) {
jQuery('#dialog1').effect("shake", { times:2 }, 50);
dialogWidget1.show();
} else {
dialogWidget1.hide();
}
}
</script>