9 Replies Latest reply on Aug 7, 2007 5:09 PM by ebaugh

    rich:panel and inputText

    ebaugh

      I'm new to rich faces (and fairly new to JSF as well), and have a question regarding using inputText inside a rich:panel.

      With the following:

      <!-- General Prefs Panel. -->
      <a4j:outputPanel ajaxRendered="true" keepTransient="true">
      <rich:panel rendered="#{mainController.generalPrefsEnabled}">
      <h:form id="generalPrefsForm">
      <h:panelGrid columns="2">
      <h:outputText value="Home Zip Code: " style="FONT-FAMILY: 'Arial'; FONT-SIZE: small;"/>
      <h:inputText id="homeZipCode" value="#{user.homeZipCode}" />
      <h:outputText value="Work Zip Code: " style="FONT-FAMILY: 'Arial'; FONT-SIZE: small;"/>
      <h:inputText id="workZipCode" value="#{user.workZipCode}" />
      <h:outputText value=" " />
      <h:outputText value=" " />
      <h:commandButton value="Save" action="#{user.saveZips}" />
      <h:outputText/>
      </h:panelGrid>
      <h:messages fatalClass="error" errorClass="error" infoClass="info" showDetail="true" />
      </h:form>
      </rich:panel>
      </a4j:outputPanel>


      I have a rich:panel that I turn on and off based on a menu selection. That all works just fine. But the input areas, they behave strangely. When I first render the rich:panel, I can type in the input areas, but clicking on the command button doesn't save, but a second click (and on, third, etc...until I render another panel and come back) saves.

      Can someone shed some light on what newbie or stupid thing I've not groked here regarding this?

      Thanks.

      Earl

        • 1. Re: rich:panel and inputText

          does it work just fine if you have no 'rendered' attribute for this rich:panel ?

          P.S.
          Why you use keepTransient="true" here?

          • 2. Re: rich:panel and inputText
            ebaugh

            Yes, it works when I have the "rendered" attribute removed.

            I have the keepTransient="true" there based on the recommendation/example on another page I found....
            I did some more reading on it as part of checking this right now, and
            I don't see any reason I'd need it.

            I've removed it for this issue, and it alter the behavior.



            Earl

            • 3. Re: rich:panel and inputText
              ebaugh

              That is, it did not alter the behavior. I removed it before I removed the rendered attribute.

              Earl

              • 4. Re: rich:panel and inputText

                I general, the input does not work because rendered="#{mainController.generalPrefsEnabled}" is false at the beginning of the second phase of JSF lifecycle. It is still a questionable - why.
                Do you have a suggestion about it? What is the scope for #{mainController}

                • 5. Re: rich:panel and inputText
                  ebaugh

                  The scope of mainController is session.

                  I have a rich:dropDownMenu with rich:menuItems which trigger the enabling/disabling of the rich:panel.

                  The relevant line is:

                  <rich:menuItem submitMode="ajax" value="General" action="#{mainController.setGeneralPrefsEnabled}"/>

                  That sets the value to enable the panel.

                  You're saying that in the beginning of "Apply Request Values" the value is false? The mainController bean does set all the values to false initially. But once someone selects the menu item, it sets the flag to true (and the rich:panel actually displays...)

                  I'm not sure how I could change this....

                  Earl

                  • 6. Re: rich:panel and inputText

                     

                    "ebaugh" wrote:

                    You're saying that in the beginning of "Apply Request Values" the value is false?


                    Yes. The processing of the components is starting there. Processing means Decoding, Conversion and updating model.
                    If 'rendered' is false (as well as read only flag is true), JSF bypass decoding for this component and the whole its hierarchy.

                    I cannot say why based on your code snippet. Probably, it is a good idea to add phase listener and check the value there.

                    • 7. Re: rich:panel and inputText
                      ebaugh

                      I'll check into a phase listener to verify the value.

                      But I'm a little confused, I wouldn't expect to see the data on the panel with the value still false. You're saying it's possible for it to not decode this component but somehow later for the item to show up??

                      Because when I have that rendered tag in, it toggles correctly, at least in terms of displaying on the page.


                      Earl

                      • 8. Re: rich:panel and inputText
                        ebaugh

                        I found my issue. I had a tag in the wrong place, and it had nested two forms.

                        • 9. Re: rich:panel and inputText
                          ebaugh

                          I found my issue. I had a tag in the wrong place, and it had nested two forms.