I have <h:form>
inside a <p:dialog>
. The <p:commandButton>
doesn't fire any action when dynamic="true"
is set in dialog. When I take out the dynamic="true"
, then it works.
My bean is view scoped and the command button works outside the dialog. I have already verified that the form is not nested.
Here's the view:
<p:dialog header="Editar" widgetVar="dlgChamadoEdit" resizable="true"
id="chamadosDlgEdicao" showEffect="fade" hideEffect="drop"
dynamic="true" maximizable="true" minimizable="true" width="1000px"
height="500px" appendToBody="false" >
<h:form id="chamadoEdicao" prependId="false">
<p:messages id="messages" />
<h:inputHidden id="acao" value="#{Chamados.acao}" />
<h:panelGrid columns="4">
<h:outputLabel value="Cliente: " />
<p:inputText value="#{Chamados.chamado.cliente}" type="name"
required="true" requiredMessage="Cliente é requerido. " />
<h:outputLabel value="Número: " />
<p:inputText value="#{Chamados.chamado.id}" type="name"
readonly="true">
<f:convertNumber integerOnly="true" minIntegerDigits="1" />
</p:inputText>
<h:outputLabel value="Nome:" />
<p:inputText value="#{Chamados.chamado.nome}" type="name"
required="true" requiredMessage="Nome é requerido. " />
<h:outputLabel value="Status:" />
<p:selectOneMenu styleClass="element select"
style="margin-left:20px; width:300px"
value="#{Chamados.chamado.status}" converter="javax.faces.Integer">
<f:selectItems value="#{Chamados.keyAsList}" var="status"
itemLabel="#{Chamados.listaStatus[status]}" itemValue="#{status}" />
</p:selectOneMenu>
<h:outputLabel value="Pessoa de contato: " />
<p:inputText value="#{Chamados.nomePessoaDeContatoString}"
type="name" />
<h:outputLabel value="Id da chamada: " />
<p:inputText value="#{Chamados.chamado.idChamada}" type="name"
readonly="true" />
<h:outputLabel value="Número do Telefone: " />
<p:inputText value="#{Chamados.chamado.numeroTelefone}" type="name" />
<h:outputLabel value="Prioridade: " />
<p:selectOneMenu styleClass="element select"
style="margin-left:20px; width:300px"
value="#{Chamados.chamado.prioridade}"
converter="javax.faces.Integer">
<f:selectItems value="#{Chamados.prioridadeKeyAsList}"
var="prioridade"
itemLabel="#{Chamados.listaPrioridade[prioridade]}"
itemValue="#{prioridade}" />
</p:selectOneMenu>
<h:outputLabel value="Numero de serie do fabricante: " />
<p:inputText value="#{Chamados.chamado.numeroSerieFabricante}"
type="name" />
<h:outputLabel value="Criado em: " />
<p:inputText value="#{Chamados.chamado.criadoEm}" type="name"
size="16" maxlength="16" readonly="true"
onkeypress="Mascara(this,Data);">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"
timeZone="#{initParam.timezone}" />
</p:inputText>
<h:outputLabel value="Numero de serie: " />
<p:inputText value="#{Chamados.chamado.numeroSerie}" type="name" />
<h:outputLabel value="Fechado em: " />
<p:inputText value="#{Chamados.chamado.fechadoEm}" type="name"
size="16" maxlength="16" readonly="true">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"
timeZone="#{initParam.timezone}" />
</p:inputText>
<h:outputLabel value="Item: " />
<p:inputText value="#{Chamados.chamado.item}" type="name" />
<h:outputLabel value="Numero do contrato: " />
<p:inputText value="#{Chamados.chamado.numeroContrato}" type="name" />
<h:outputLabel value="Descricao: " />
<p:inputText value="#{Chamados.chamado.descricao}" type="name" />
<h:outputLabel value="Data Final: " />
<p:inputText value="#{Chamados.chamado.dataFinal}" type="name"
size="16" maxlength="16" readonly="true">
<f:convertDateTime pattern="dd/MM/yyyy HH:mm"
timeZone="#{initParam.timezone}" />
</p:inputText>
<h:outputLabel value="Grupo de itens: " />
<p:inputText value="#{Chamados.nomeGrupoItemString}" type="name" />
<h:outputLabel value="Assunto: " />
<p:inputText value="#{Chamados.chamado.assunto}" type="name"
required="true" requiredMessage="Assunto é requerido. " />
</h:panelGrid>
<div class="form_description">
<p></p>
</div>
<h:panelGrid columns="4">
<h:outputLabel value="Origem:" />
<p:selectOneMenu styleClass="element select"
style="margin-left:20px; width:300px"
value="#{Chamados.chamado.origem}" converter="javax.faces.Integer">
<f:selectItems value="#{Chamados.origensKeyAsList}" var="origem"
itemLabel="#{Chamados.listaOrigens[origem]}"
itemValue="#{origem}" />
</p:selectOneMenu>
<h:outputLabel value="Processador: " />
<p:inputText value="#{Login.usuario.nome}" type="name"
readonly="true" />
<h:outputLabel value="Tipo problema:" />
<p:selectOneMenu styleClass="element select"
value="#{Chamados.chamado.tipoProblema}"
style="margin-left:20px; width:300px"
converter="javax.faces.Integer">
<f:selectItems value="#{Chamados.tiposProblemasKeyAsList}"
var="problema"
itemLabel="#{Chamados.listaTiposProblemas[problema]}"
itemValue="#{problema}" />
</p:selectOneMenu>
<h:outputLabel value="Fila: " />
<p:selectOneMenu styleClass="element select"
value="#{Chamados.chamado.fila}"
style="margin-left:20px; width:300px">
<f:selectItems value="#{Chamados.filasKeyAsList}" var="fila"
itemLabel="#{Chamados.listaFilas[fila]}" itemValue="#{fila}" />
</p:selectOneMenu>
<h:outputLabel value="Tipo Chamado: " />
<p:selectOneMenu styleClass="element select"
value="#{Chamados.chamado.tipoChamado}"
style="margin-left:20px; width:300px"
converter="javax.faces.Integer">
<f:selectItems value="#{Chamados.tiposchamadosKeyAsList}"
var="tipochamado"
itemLabel="#{Chamados.listaTiposChamados[tipochamado]}"
itemValue="#{tipochamado}" />
</p:selectOneMenu>
<h:outputLabel value="Responsável: " />
<p:inputText value="#{Chamados.nomeResponsavelString}" type="name" />
</h:panelGrid>
<div class="form_description">
<p></p>
</div>
<h:panelGrid columns="2">
<h:outputLabel value="Descrição: " style="margin-left: 100px" />
<h:outputLabel value="Resolução: " style="margin-left: 100px" />
<p:inputTextarea cols="32" rows="5"
value="#{Chamados.chamado.descricaoObs}"
style="overflow:scroll;margin-left: 100px" />
<p:inputTextarea cols="32" rows="5"
value="#{Chamados.chamado.resolucao}"
style="overflow:scroll;margin-left: 100px" />
</h:panelGrid>
<div class="form_description">
<p></p>
</div>
<p:commandButton value="Adicionar"
actionListener="#{Chamados.cadastraChamado}" />
</h:form>
<h:form>
<p:commandButton action="#{Chamados.testButtonAction}" imediate="true"/>
<p:commandButton
actionListener="#{Chamados.testButtonActionListener}" />
</h:form>
</p:dialog>
Here's the bean:
public String testButtonAction() {
System.out.println("testButtonAction invoked");
return "anotherPage.xhtml";
}
public void testButtonActionListener(ActionEvent event) {
System.out.println("testButtonActionListener invoked");
}
How is this caused and how can I solve it by keeping <p:dialog dynamic="true">
?