p:confirmdialog dont call the action method

UI Components for JSF
Serial
Posts: 19
Joined: 17 Jun 2010, 03:06
Location: Brazil

01 Sep 2010, 02:44

I'm tying to use the confirm dialog with 2 p:commandbuttons inside of it but the action method is not being called
with the property ajax="true" the dialog closes but the action method is never called, with ajax="false" nothing happens at all.

I've tried to test it in firebug but i never used it and i wasn't able to find if the ajax event fired =|

my code

Code: Select all

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="Template.xhtml">
        <h:form prependId="false">
            <div align="center">
                Buscar Projeto
                <br/>
                <br/>

                <h:panelGrid columns="3">
                    <h:outputLabel value="Buscar: "/>
                    <h:selectOneMenu id="projeto" value="#{projetoBean.projeto_selecionado}" required="true" requiredMessage="Selecione um Projeto!">
                        <f:selectItems value="#{projetoBean.lista_projetos}"/>
                    </h:selectOneMenu>
                    <p:commandButton ajax="false" value="Buscar" action="#{projetoBean.buscar_Projeto}" update="growl"/>
                </h:panelGrid>

            </div>
        </h:form>
        <h:form prependId="false">

            <div >
                <h:panelGrid id="grid" columns="3">
                    <h:outputText value="Nome do Projeto: " />                    
                    <h:inputText id="nome" required="true" requiredMessage="Digite o nome do Projeto!" maxlength="45"  value="#{projetoBean.nome}"/>
                    <h:outputText style="color: red" value="*"/>
                    <h:outputText value="Descrição: "/>                    
                    <h:inputText id="descricao" maxlength="200"  value="#{projetoBean.descricao}"/>
                    <h:outputText  value=""/>
                    <h:outputText value="Data de Início: "/>                    
                    <p:calendar id="data_de_inicio" readOnlyInputText="true" pattern="dd/MM/yyyy" required="true" requiredMessage="Selecione a data de início!" effect="explode" locale="pt_BR" showButtonPanel="true" value="#{projetoBean.data_de_inicio}"/>
                    <h:outputText style="color: red" value="*"/>
                    <h:outputText value="Data de Término: "/>                   
                    <p:calendar id="data_de_termino" readOnlyInputText="true" pattern="dd/MM/yyyy" locale="pt_BR" effect="explode" showButtonPanel="true" value="#{projetoBean.data_de_termino}"/>
                    <h:outputText  value=""/>
                </h:panelGrid>

                <br/>
                <p:commandButton value="Salvar" onclick="confirmacao.show()"/>


                <p:confirmDialog message="Tem certeza que deseja modificar esse projeto?" header="Salvar" severity="warn"  widgetVar="confirmacao" position="center">

                    <p:commandButton ajax="true" value="Sim" update="growl" action="#{projetoBean.editarProjeto}" oncomplete="confirmacao.hide()" type="submit" />
                    <p:commandButton value="Não" onclick="confirmacao.hide()" type="button" />

                </p:confirmDialog>


                <br/>
            </div>
        </h:form>
        <p:growl id="growl" showDetail="true" />
    </ui:composition>

</html>
I'm using primefaces 2.1 and I've tried using the 2.2.M1-SNAPSHOT build but no luck so far
using the same p:commandbutton with ajax set to false outside the dialog works fine.

Thanks for the help =)
Using Primefaces 2.2.M1, JSF 2.0 on Netbeans 6.9 + glassfish v3

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Sep 2010, 03:02

Hi,

What is your envionment?

Showcase seem to work fine;

http://www.primefaces.org/labs/ui/confirmDialog.jsf

Serial
Posts: 19
Joined: 17 Jun 2010, 03:06
Location: Brazil

01 Sep 2010, 03:13

I'm using glassfish v3 with netbeans 6.9
Using Primefaces 2.2.M1, JSF 2.0 on Netbeans 6.9 + glassfish v3

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Sep 2010, 03:31

JSF and PrimeFaces version?

Please see number #5 at;

http://primefaces.prime.com.tr/forum/vi ... f=3&t=1194

Serial
Posts: 19
Joined: 17 Jun 2010, 03:06
Location: Brazil

01 Sep 2010, 03:37

I did in my first post :D
primefaces 2.1, JSF 2.0
Using Primefaces 2.2.M1, JSF 2.0 on Netbeans 6.9 + glassfish v3

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Sep 2010, 03:42

I've missed that, your signature is the best place to add this info so you don't need to mention it everytime.

Regarding your question, so when you click yes or no, ajax request is not sent right? Do you get any js error?

Serial
Posts: 19
Joined: 17 Jun 2010, 03:06
Location: Brazil

01 Sep 2010, 04:01

well checking the firebug console I didnt see any js errors,
When i click the "no" button("Não" in my app) the dialog closes
When i click the "yes" button ("Sim" in my app) the dialog closes but the action is not called

The no button dont do anything in firebug, when i click the yes button i can see a POST action in the console

POST

Code: Select all

Parameters    application/x-www-form-urlencoded
data_de_inicio_input	03/08/2010
data_de_termino_input	31/08/2010
descricao	yyyy
j_idt28	j_idt28
j_idt41	j_idt41
javax.faces.ViewState	-5241006650298327095:-6702061935384652190
nome	teste
primefacesPartialRequest	true
primefacesPartialUpdate	growl

Source
j_idt28=j_idt28&nome=teste&descricao=yyyy&data_de_inicio_input=03%2F08%2F2010&data_de_termino_input=31%2F08%2F2010&javax.faces.ViewState=-5241006650298327095%3A-6702061935384652190&primefacesPartialRequest=true&j_idt41=j_idt41&primefacesPartialUpdate=growl

ANSWER

Code: Select all

<?xml version="1.0" encoding="UTF-8"?><partialResponse><components></components><state><![CDATA[<input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-5241006650298327095:-2909479389747472860" autocomplete="off" />]]></state><callbackParams><callbackParam>{"validationFailed":false}</callbackParam></callbackParams></partialResponse>

There is also this code in the Script Tab, I think the ajax event was fired.

Code: Select all


function onclick(event) {
        PrimeFaces.ajax.AjaxRequest("/VertRequisite/faces/modifProjeto.xhtml", {formId: "j_idt28", oncomplete: function (xhr, status, args) {confirmacao.hide();}, global: true}, {j_idt41: "j_idt41", primefacesPartialUpdate: "growl"});
        return false;
    } 

Using Primefaces 2.2.M1, JSF 2.0 on Netbeans 6.9 + glassfish v3

edunobre
Posts: 2
Joined: 01 Sep 2010, 04:44

01 Sep 2010, 05:13

Dear People,
I have the same problem mention above and I noticed that the problem happens with IE8.
It seems that after the dialog tag the page is not loading with IE8. That explains why some code is not executed
I also visited the primafaces dialog page (with IE8) and the same happens and you will see that the source code is not showed. By the way, the dialog is shown even on IE8.
Exposing that, is there any workaround?
Thanks a lot

Eduardo Nobre

Serial
Posts: 19
Joined: 17 Jun 2010, 03:06
Location: Brazil

01 Sep 2010, 06:06

My problem wasnt with IE8 I'm using chrome, but i think I've found the damn thing

The problem was that i was using the primefaces 2.2.M1-SNAPSHOT and forgot to remove the file from my app lib folder, using the 2.1 build the dialog works fine, when I've tried to use the 2.2 again the dialog buttons stopped working =|

So far I wasn't able to fix the problem using 2.2 but since its not a released version something might be wrong with the code, only optimus to clarify that now xD

And thank you very much for you time trying to help me optimus =)
Using Primefaces 2.2.M1, JSF 2.0 on Netbeans 6.9 + glassfish v3

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

02 Sep 2010, 02:36

Can you check with showcase using your chrome? It has latest 2.2-M1-build. Also we've fixed some dialog issues with IE recently which happened after jquery ui update. So it should be fine now.

http://www.primefaces.org/labs/ui/confirmDialog.jsf

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 38 guests