Is there a way to use PrimeFaces RequestContext
to call a dialog defined in the JSF from a managed bean, which has a form, but synchronously, meaning that the managed bean wait its thread execution until the user submits the form?
Currently, I am successfully invoking a dialog from my managed bean but the call is asynchronous, meaning the dialog is popped open but the managed bean thread continues on without waiting for the user to supply the needed additional data via the dialog.
So, in my JSF, I have the dialog defined as follows:
<p:dialog header="My Dialog" widgetVar="myDialog" modal="false" height="100">
<h:form>
<h:outputLabel for="inputData" value="Input Data:"/>
<p:inputText id="inputData" title="Input Data"
maxlength="16" required="true" ... >
</p:inputText>
<h:commandButton value="Submit"/>
</h:form>
</p:dialog>
In my managed bean, I call the dialog conditionally if some criteria is met:
...
if(noteReqd) {
RequestContext requestContext = RequestContext.getCurrentInstance();
requestContext.execute("PF('myDialog').show();");
//here I want the managed bean to stop until the user supplies the extra data needed
//but it just proceeds downstream without the data the user enters
}
...
RELATED: