I have a dialog thus:
<p:dialog id="pinDialog" widgetVar="pinDialog" width="800" binding="#{userBean.pinCheckDialog}" closable="false" modal="true" closeOnEscape="false" showEffect="clip" hideEffect="clip">
<h:form id="pinEntry">
<p:messages for="messagesForPinCheck"/>
<p:outputLabel for="pinCode" value="#{messages.PinCodeRequired}"/>
<p:inputText value="#{userBean.enteredPin}" size="4" id="pinCode"/>
<p:commandButton value="#{messages.PinCodeSubmit}" update="@form" action="#{userBean.submitPin()}"/>
</h:form>
</p:dialog>
And within a idleMonitor
I am calling active()
and idle()
on the userBean
. If the user goes idle and other conditions hold true I want to show the pinDialog
:
if (isPinRequired()) {
logger.debug("pin required, attempting to show pin dialog");
RequestContext.getCurrentInstance().execute("pinDialog.show()");
}
The log message appears, but nothing happens on screen. I have also tried PF('pinDialog').show
without success. What am I doing wrong?
If you want to show a dialog at another time besides page load, then you will want to use the 'render' attribute on the dialog form.
<p:panelGroup id="mainPanel">
<p:dialog rendered="#{myBean.showForm}"
</p:dialog>
</p:panelGroup>
Where showForm is a boolean function in your backing bean returning false normally.
Without the outside p:panelGroup and p:dialog normally rendering false, it would never show up even when render was set to true.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.