2 Replies Latest reply on Mar 14, 2008 8:02 AM by shimonl97

    rendered Attribute breaks a4j support?

    gressho

      Hello,

      I've tried some time to get an <a4j:support> element to work and
      found some strange behaviour:
      When I use a4j elements in an element with a rendered attribute it won't work
      anymore! In the code below, the a4j:support doesn't do anything, even the
      <h:commandLink> doesn't do anything!
      When I remove the rendered attribute from the surrounding <rich:panel> everything
      works well...
      I'm not using RichFaces for long, so I might have made some errors and would be
      grateful to anybody showing me a way through this.

      <div xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
       <ui:composition template="../../layout/template.xhtml">
      
       <ui:define name="body">
      
       <rich:panel id="editPanel" rendered="#{mandatorManagement.userIsAdmin}">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="#{message.headerEditMandator}" rendered="#{mandatorManagement.mandator.id != 0}"/>
       <h:outputText value="#{message.headerCreateMandator}" rendered="#{mandatorManagement.mandator.id == 0}"/>
       </h:panelGroup>
       </f:facet>
       <a4j:form ajaxSubmit="true">
       <h:panelGrid columns="2">
       <h:outputText value="#{message.catalog}"/>
       <h:inputText value="#{mandatorManagement.mandator.description}"
       required="true"
       immediate="false"
       size="50"
       maxlength="80">
       <a4j:support event="onkeyup" ajaxSingle="true" immediate="true" reRender="test"/>
       </h:inputText>
       <h:outputText value="#{message.catalog}"/>
       <h:outputText id="test" value="#{mandatorManagement.mandator.description}"/>
       </h:panelGrid>
       <h:panelGroup>
       <h:commandLink value="#{message.save}"
       action="#{mandatorManagement.save}"
       style="border:2px; margin-right:10px">
       <h:graphicImage value="/icons/16x16/actions/document-save.png"
       style="border:0px; vertical-align:bottom; margin-left:10px"/>
       </h:commandLink>
       <h:commandLink value="#{message.back}"
       action="#{mandatorManagement.back}"
       immediate="true"
       style="border:2px; margin-right:10px">
       <h:graphicImage value="/icons/16x16/actions/process-stop.png"
       style="border:0px; vertical-align:bottom; margin-left:10px"/>
       </h:commandLink>
       </h:panelGroup>
       <h:messages globalOnly="true"/>
       </a4j:form>
       </rich:panel>
      
       </ui:define>
       </ui:composition>
      </div>
      


        • 1. Re: rendered Attribute breaks a4j support?
          gressho

          I forgot to mention: I'm using JBoss 4.2.2, JBoss Portal 2.6.4, JBoss Portlet Bridge 1.0.B1 and RichFaces 3.1.4.

          • 2. Re: rendered Attribute breaks a4j support?

            Don't know about the render tag, but I think you have few mistakes in your page.
            1. Why do you use a4j:form? a4j:form is for special cases and doesn't work as you expect with h:commandButton.

            2. You declare your a4j support as immediate="true", in this case the model is not updated so you will so no change in #{mandatorManagement.mandator.description}" value, use immediate when you need to validate or do some action, but not if you want updateModel phase to be activated