9 Replies Latest reply on Aug 25, 2009 9:33 AM by j2buzon

    problems with modalpanel

      I use reRender in a4j: CommandButton that opens modalpanel, but the problem is when the fields required in modalpanel not pass validation, and then re-open modalPanel maintains the values previously typed.

      I use a actionListener in the a4j:CommandButton that opens the modal to clean the bean that points to the values of the modal fields and the problem persists

        • 1. Re: problems with modalpanel
          ilya_shaikovsky

          http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf?tab=editDataTable

          the same situation (validation inside modal) but working.

          • 2. Re: problems with modalpanel

            thanks, I'll look.

            • 3. Re: problems with modalpanel

              I have not solved the problem.
              I have the same as in the example code and still keeps showing me the values previously typed in modalPanel. will be some configuration?

              • 4. Re: problems with modalpanel
                timgozag

                You have to clear out all the UIComponent of the modal panel's form (get it from FaceContext). When you open the modal Panel again, you just reRender the modal's form and all your initial values will be there.

                ilya_shaikovsky: I don't know how they make it works but it's cool. Do you know where I can get the source code of richfaces demo?

                • 5. Re: problems with modalpanel

                  the source code of the demo you can get it here http://www.jboss.org/richfaces/demos.html.
                  And as you can see they do nothing extra code.
                  the xhtml you can find it in RichFaces / dataTable / examples / editTable.xhtml

                  appreciate any help

                  • 6. Re: problems with modalpanel

                    Hi,

                    I faced the same issue,

                    Please follow the link

                    http://www.jboss.org/index.html?module=bb&op=viewtopic&t=160234

                    Nick and his team is really helpful.

                    I was able to solve it somehow.
                    Let me know if you need help.

                    Akash
                    http://www.thedaedals.com/

                    • 7. Re: problems with modalpanel

                      but as you can see in the demo source code not using any of these techniques.

                      that may be?

                      • 8. Re: problems with modalpanel

                        my code:

                        admTipIdent.xhtml:


                        <h:form>

                        <a4j:region>

                        <rich:panel>

                        <rich:messages style="text-align:center;" globalOnly="true"
                        showDetail="true" showSummary="false" errorClass="errorMessages"
                        fatalClass="fatalMessages" warnClass="warningMessages"
                        infoClass="infoMessages" />

                        <a4j:commandButton value="#{sicc.lblBtnNew}" ajaxSingle="true"
                        actionListener="#{admMB.new}"
                        reRender="itCod, itDesc"
                        oncomplete="#{rich:component('mpTipIdent')}.show()">
                        </a4j:commandButton>


                        <rich:dataTable align="center" rows="15" width="100%"
                        id="dtTipIdent"
                        value="#{admMB.tipsIdent}"
                        var="tipIdent" rowKeyVar="row"
                        onRowMouseOver="this.style.backgroundColor='#C8DBFF'"
                        onRowMouseOut="this.style.backgroundColor='#{aj4Skin.rowBackgroundColor}'">


                        <rich:column style="text-align:center">
                        <f:facet name="header">
                        <h:outputText value="#{sicc.lblEdit}" />
                        </f:facet>
                        <a4j:commandLink ajaxSingle="true" id="editlink"
                        reRender="itCod, itDesc"
                        oncomplete="#{rich:component('mpTipIdent')}.show()">
                        <h:graphicImage value="/images/icons/edit.gif" style="border:0" />
                        <f:setPropertyActionListener value="#{tipIdent}"
                        target="#{admMB.objSelected}" />
                        <f:setPropertyActionListener value="true"
                        target="#{admMB.edit}" />
                        </a4j:commandLink>
                        <rich:toolTip for="editlink" value="#{sicc.lblEditar}" />
                        </rich:column>

                        ....
                        ....

                        </rich:panel>

                        </a4j:region>

                        </h:form>

                        <ui:include src="/jsf/admin/tipIdent.xhtml" />

                        .....
                        .....




                        tipIdent.xhtml:
                        ----------------

                        <rich:modalPanel xmlns="http://www.w3.org/1999/xhtml"
                        xmlns:h="http://java.sun.com/jsf/html"
                        xmlns:a4j="http://richfaces.org/a4j"
                        xmlns:rich="http://richfaces.org/rich"
                        xmlns:f="http://java.sun.com/jsf/core"
                        xmlns:ui="http://java.sun.com/jsf/facelets" id="mpTipIdent"
                        autosized="true" width="700">

                        <f:facet name="header">
                        <h:outputText value="#{msg.ModalTipIdent}" />
                        </f:facet>

                        <f:facet name="controls">
                        <h:panelGroup>
                        <h:graphicImage value="/images/close.png" id="hidecontrol"
                        styleClass="hidelink" />
                        <rich:componentControl for="mpTipIdent"
                        attachTo="hidecontrol" operation="hide" event="onclick" />
                        </h:panelGroup>
                        </f:facet>

                        <h:form id="frmTipIdent" prependId="false">

                        <a4j:keepAlive beanName="admMB" />

                        <rich:messages style="text-align:center;" globalOnly="true"
                        showDetail="true" showSummary="false" errorClass="errorMessages"
                        fatalClass="fatalMessages" warnClass="warningMessages"
                        infoClass="infoMessages" />


                        <h:panelGrid columns="1" align="center" width="100%">

                        <a4j:outputPanel id="opFields" ajaxRendered="true">

                        <h:panelGrid columns="3" width="100%">

                        <h:outputText value="#{admon.lblCodigo} *"></h:outputText>
                        <h:inputText id="itCod" size="4" maxlength="2"
                        label="#{admon.lblCodigo}"
                        readonly="#{administraTipoIdentificacionMB.editar}"
                        value="#{admMB.objSelected.cod}"
                        required="true" />
                        <rich:message for="itCod"></rich:message>

                        <h:outputText value="#{admon.lblDescripcion} *"></h:outputText>
                        <h:inputText id="itDesc" size="50" maxlength="45"
                        label="#{admon.lblDescripcion}"
                        value="#{{admMB.objSelected.desc}"
                        required="true" />
                        <rich:message for="itDesc"></rich:message>


                        </h:panelGrid>

                        </a4j:outputPanel>

                        <h:panelGrid columns="2" width="100%">
                        <a4j:commandButton id="btn_edit"
                        value="#{sicc.lblBtnSave}"
                        action="#{admMB.save}"
                        reRender="dtTipsIdent"
                        oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('mpTipIden')}.hide();" />

                        <a4j:commandButton
                        value="#{sicc.lblBtnClose}" id="close"
                        onclick="#{rich:component('mpTipIdent')}.hide(); return false;" />

                        </h:panelGrid>

                        </h:panelGrid>

                        </h:form>

                        </rich:modalPanel>




                        appreciate any help

                        • 9. Re: problems with modalpanel

                          problem solved as suggested by timgozag

                          clear out all the UIComponent of the modal panel's form (get it from FaceContext)

                          thank all