0

If I click on the p:commandButton at the end, with the value="Reservar", without choosing a field on the f:selectItem, the p:messages with the id "bookingMessages" gets updated (and correctly so). I now close the FacesMessage and click the p:commandButon again. Now nothing happens. For it to work again, I need to refresh the page.

Edit 1: I'm on PF 5.2 and JSF 2.2.8.

Any ideas on where my mistake is?

<h:form id="form" class="Container90 Fnone MarAuto">
    <p:messages autoUpdate="true" showDetail="true" closable="true"/>
    <p:panel id="panel" header="Reservas de Áreas Comuns" >
        <h:panelGrid cellpadding="5">
            <p:commandButton value="Incluir" oncomplete="PF('bookingDialog').show()" update=":form:bookingDialog">
                <f:setPropertyActionListener value="#{null}" target="#{bookingMoradorController.currentItem}" />
                <f:setPropertyActionListener value="newMorador" target="#{bookingMoradorController.action}" />
            </p:commandButton>
        </h:panelGrid>

        <p:dataTable id="dataTable" emptyMessage="Nenhum registro encontrado." class="TexAlCenter" var="object" value="#{bookingMoradorController.reservesMorador}">  
            <p:column headerText="Unidade" class="Wid8 TexAlCenter">  
                <h:outputText value="#{object.unit.externalIdentifier}" />  
            </p:column>  
            <p:column headerText="Valor (R$)" class="TexAlRight">
                <h:outputText value="#{object.feeValue}" />  
            </p:column>  
        </p:dataTable>

        <p:dialog closeOnEscape="true" showEffect="fade" hideEffect="fade" header="Reservar Área Comum" widgetVar="bookingDialog" resizable="false" id="bookingDialog" modal="true">
            <p:messages id="bookingMessages" showDetail="true" closable="true"/>
            <h:panelGrid columns="2" cellpadding="5">
                <p:outputLabel for="idCommonArea" value="Área Comum"/>

                <p:selectOneMenu value="#{bookingMoradorController.selectedIdCommonArea}" id="idCommonArea" effect="fade" style="width: 178px" >    
                    <f:selectItem itemLabel="Selecione um Local" itemValue="#{null}"/>      
                    <f:selectItems value="#{bookingMoradorController.commonAreas}" var="object" itemLabel="#{object.name}" itemValue="#{object.idCommonArea}"/>  
                </p:selectOneMenu>

                <p:outputLabel for="calendarMask" value="Data do Evento"/>
                <p:calendar locale="pt" id="calendarMask" value="#{bookingMoradorController.dateEvent}" pattern="dd-MM-yyyy" mask="true" />
            </h:panelGrid>

            <div class="EmptyBox10"/>
            <p:separator/>
            <div class="EmptyBox10"/>

            <h:panelGrid columns="2" cellpadding="5" class="MarAuto">
                <p:commandButton value="Reservar" action="#{bookingMoradorController.save()}" update=":form:dataTable bookingMessages" oncomplete="bookingDialog.hide()" ignoreAutoUpdate="true"/>
                <p:commandButton value="Cancelar" class="RedButton" action="/ondomi/morador/bookingList.xhtml?faces-redirect=true" process="@this" /> 
            </h:panelGrid>
        </p:dialog>
    </p:panel>
</h:form>    

Thank you.

Diogo Garcia
  • 27
  • 1
  • 9
  • Please elaborate "nothing happens" in developer's perspective instead of enduser's perspective. This site is for developers, not endusers. As first step, check browser's JS console and HTTP traffic monitor for clues. – BalusC Jul 27 '15 at 14:49
  • What PF version? If on 5 I believe you should use PF('bookingDialog').hide() – Jaqen H'ghar Jul 27 '15 at 17:03
  • BalusC, I'm still growing my developer's perspective. Thanks for the heads-up. I did use HTTP traffic to understand what was going on. The referente for the bookingDialog was broken (as Jaqen pointed out below). Another problem was that the bookingMoradorController.save() method was already returning a web page, so the oncomplete is actually unecessary. I've removed it and everything worked out. Thank you both! – Diogo Garcia Jul 27 '15 at 20:34
  • This problem is covered by point 6 in duplicate. – BalusC Jul 27 '15 at 20:56

0 Answers0