Dialog framework does not close when it has an input field

Locked
jmsanchezbz
Posts: 3
Joined: 16 Mar 2017, 10:22

16 Mar 2017, 10:25

I'm trying to close a dialog with a cancel button, I receive the event but the dialog does not close. After a lot of digging I realize the problem is where the dialog has an input field with the ticket description, but it works when I remove it and I leave only de buttons.
It also happens with other types of components and much more complicated forms.

Does it make any sense? Is there a bug with primefaces?
Thanks in advance!

Form base code

Code: Select all

...
<p:commandButton icon="fa fa-bug" actionListener="#{ticketBean.viewTicket}"/>
...
TicketBean code

Code: Select all

@ManagedBean
@ViewScoped
public class TicketBean {
...
public void viewTicket() {
    logger.info("--------------ViewTicket");
    Map<String, Object> options = new HashMap<>();
    options.put("modal", true);
    options.put("width", 640);
    options.put("height", 250);
    options.put("resizable", false);
    options.put("contentWidth", "100%");
    options.put("contentHeight", "100%");
    options.put("closable", false);

    RequestContext.getCurrentInstance().openDialog("maintenance/ticket", options, null);
}

public void cancel() {
    RequestContext.getCurrentInstance().closeDialog(null);
}
...
ticket.xhtml dialog code DOES NOT WORK

Code: Select all

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title>#{msgs.ticket_create}</title>
    </h:head>

    <h:body>
        <h:form id="frmTicket">
            <p:inputTextarea rows="5" cols="70" value="#{ticketBean.ticket.descripcio}" >
            </p:inputTextarea>
            <br/>
            <h:inputHidden value="#{ticketBean.ticket.path}" />
            <p:commandButton value="#{msgs.save}" style="width:auto" 
                      styleClass="GreenButton"
                      actionListener="#{ticketBean.save}"/>
            <p:commandButton value="#{msgs.cancel}" style="width:auto" 
                      styleClass="RedButton"
                      actionListener="#{ticketBean.cancel}"/>
        </h:form>
    </h:body>

</html>
ticket.xhtml dialog code DOES WORK

Code: Select all

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title>#{msgs.ticket_create}</title>
    </h:head>

    <h:body>
        <h:form id="frmTicket">
            <p:commandButton value="#{msgs.save}" style="width:auto" 
                      styleClass="GreenButton"
                      actionListener="#{ticketBean.save}"/>
            <p:commandButton value="#{msgs.cancel}" style="width:auto" 
                      styleClass="RedButton"
                      actionListener="#{ticketBean.cancel}"/>
        </h:form>
    </h:body>

</html>
faces-config.xml

Code: Select all

...
<application>
  <action-listener>
    org.primefaces.application.DialogActionListener
  </action-listener>
  <navigation-handler>
    org.primefaces.application.DialogNavigationHandler
  </navigation-handler>
  <view-handler>
    org.primefaces.application.DialogViewHandler
  </view-handler>
</application>
...
web.xml

Code: Select all

...
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
...

mert.sincan
Posts: 5281
Joined: 29 Jun 2013, 12:38

16 Mar 2017, 15:26

This isn't a layout or theme. Please use core forum; viewforum.php?f=3

Locked

Return to “Rio”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest