The background opacity of the Prives dialog box doubles when the action does not work in the dialog

I have a modal page dialog that is displayed if the user clicks the edit button. A dialog box asks for a username and password and a submit button. If the username and password are not verified, an error message is displayed.

The problem is that if the username and password are not authenticated, the modal background darkens more and more every time authentication fails.

What can cause this?

<p:dialog id="dialog" header="Login To Edit" widgetVar="dialog" visible="#{fundingBacker.loginVisible}" modal="true" 
    resizable="false" closable="false" draggable="true" rendered="#{!userBean.loggedIn}">
    <h:form>

        <p:ajaxStatus style="width:16px;height:16px;">
            <f:facet name="start">
                <p:graphicImage value="../images/loading4.gif" />
            </f:facet>
            <f:facet name="complete">
                <h:outputText value="" />
            </f:facet>
        </p:ajaxStatus>

        <p:messages autoUpdate="true" showDetail="true" />

        <h:panelGrid columns="2" cellpadding="5">

            <h:outputLabel for="lanId" value="LanID:" />
            <p:inputText value="#{currentUser.lanID}" id="lanId" required="true" label="lanId" requiredMessage="Lan ID is required" />

            <h:outputLabel for="password" value="Password:" />
            <p:password value="#{currentUser.password}" id="password" required="true" label="password" feedback="false" requiredMessage="Password is required" />

            <p:commandButton id="loginButton" value="Login" type="submit" styleClass="primaryButton" action="#{currentUser.performLogin}" update="dialog"/>

        </h:panelGrid>
    </h:form>
</p:dialog>
+5
source share
3 answers

, . , , - visible . , PrimeFaces .

- ajax. , .

<p:commandButton ... onsuccess="dialog.hide()" update="dialog" />

, , visible rendered, , , (, ).

.

<p:commandButton ... update="@form" />

. @form.

<p:commandButton ... />

RequestContext#execute().

RequestContext.getCurrentInstance().execute("dialog.hide()");
+3

Your dialogs are duplicated after each request to the server. Try setting a dialog attribute appendToBody="true"that should prevent this.

0
source

All Articles