6 Replies Latest reply on Apr 26, 2011 10:04 AM by jules poit

    [Resolved] JSF 2 - Forms render

    jules poit Newbie

      Good morning Jboss community

       

      I have a question about jsf 2. We are upgrading our project from RF 3.3.3 / JSF 1.2 to RF 4 / jsf 2.0 and we have some issues !!

       

      I noticed that when I am trying to render a form A from an other form B, then the action to the beans in the form B are only being done on the second click (I need to click twice on a button/commandLink in order to have my action processed).

       

      Here are 2 pieces a code that are not working :

       

       

      In this example the action to the bean in the popup panel on both buttons are working after the second click. Nothing happened at the first click.

       

      <h:form>

                                    <a4j:commandLink

                                                   value="Contact Us"

                                                   action="#{emailContact.reset}"

                                                   render="contactUs"

                                                   execute="@form"

                               oncomplete="#{rich:component('contactUs')}.show()" />

      </h:form>

       

      <rich:popupPanel

      id="contactUs"

                          modal="true"

                          autosized="true"

                          onmaskclick="#{rich:component('contactUs')}.hide()"

        resizeable="false">

       

               <f:facet name="controls">

                           <h:graphicImage

                                id="hidelink"

                                onmouseover="this.src='/images/fancy_close_hover.png';"

                       onmouseout="this.src='/images/fancy_close.png';"

                                     url="/images/fancy_close.png"

                                onclick="#{rich:component('contactUs')}.hide(); return false;"/>

              </f:facet>

       

        <h:form id="emailForm">

             <h:outputLabel value="Subject : " for="subject" />

              <rich:inplaceInput

               id="subject"

                                                                  inputWidth="120"

                                                                  defaultLabel="Enter An Email Subject"

                                                                  value="#{emailContact.emailSubject}"

                                                                  requiredMessage="Please enter a subject"

                                                                  validatorMessage="The subject is too short"

                                                                  required="true">

                                                                  <f:validateLength minimum="5" />

                                                        </rich:inplaceInput>

       

                                     <a4j:commandButton

                                              id="sendE"

                                              value="Send Email"

                                              render="emailForm"

        action="#{emailContact.submitEmail}" />

       

                                    <a4j:commandButton

                                              id="reset"

                                              immediate="true"

                                              render="emailForm"

                                              action="#{emailContact.reset}"

                                              value="Reset" />

       

                                    </h:form>

       

                </rich:popupPanel>

       

       

       

      So I thought at first that it was related to the popup panel, but it appears that it is not the case !

      In this second example, I am showing a table depending of the value of a select item object :

       

      <h:form  id="tableEvents">

                                    <a4j:jsFunction name="callScript" action="#{bean.init}" render="renderedFirst,firstPanelGroup" />

                                    <a4j:outputPanel id="renderedFirst" rendered="true" ajaxRendered="true">

                                              <h:panelGroup id="firstPanelGroup" rendered="#{bean.isFirstStep}">

       

                                                                            <h:selectOneMenu

                                                                                      id="fleet"

                                                                                      label="Fleet list"

                                                                                      required="true"

                                                                                      requiredMessage="Please enter a fleet."

                                                                                      value="#{bean.fleet}"

                                                                                      valueChangeListener="#{bean.loadInfo}">

                                                                                      <f:selectItem itemLabel="" itemValue="" />

                                                                                      <f:selectItems value="#{bean.fleetCollection}" />

                                                                                      <a4j:ajax

                                                                                                event="change"

                                                                                                render="renderedFirst,firstPanelGroup,listRendered,secondPanelGroup"

                                                                                                execute="@this"/>

                                                                            </h:selectOneMenu>

                                               </h:panelGroup>

                                    </a4j:outputPanel>

       

      </h:form>

       

       

      <h:form>

       

      <a4j:outputPanel id="listRendered" rendered="true" layout="block">

                                    <h:panelGroup id="secondPanelGroup" rendered="#{bean.secondPage}">

       

                                                                  <rich:extendedDataTable

                                                                            id="fleetList"

                                                                            rowClasses="odd-row"

                                                                            value="#{bean.eventsList}"

                                                                            var="event"

                                                                            sortMode="multi"

                                                                            selectionMode="none">

       

      ...some colums...

       

                                                                  </rich:extendedDataTable>

       

      </h:panelGroup>

      </a4j:outputPanel>

       

      </h:form>

       

      Sorry I cannot find a way to put the code in a tag for better showing !!!!

       

      So in both cases the actions are working in the second form at the second request !! And with the 3.3.3 / JSF 1.2 it was working perfectly :-/

       

      Why is that happening ? And how can I fix that ?

       

      Thank you for your help And thanks for the RF 4