1 Reply Latest reply on Jun 23, 2008 1:24 PM by scheible

    A4J refreshing entire page instead of specified area

    scheible

      Hello,

      I am trying to set up a form that enables/disables two different controls based on the value of a checkbox. It needs to do so without touching any of the other controls on the page. At this point, I can enable/disable the appropriate controls. However, the entire page refreshes and clears any values entered in other fields. There is no errors being issued.

      The environment this application is running is is Seam 2.0.2.GA, RichFaces 3.2.1 (patched in), and JBoss 4.2.2.GA running on Windows with Java 6 (but complying with Java 5 specs). The code snippet below is inside a regular JSF form tag and a rich:panel tag. Facelets is being used as the view handler.

      Here is the pertinent area of the page (I think):

      <a:region id="isSerialized" renderRegionOnly="true">
       <a:region>
       <s:decorate id="serialDecoration" template="/layout/edit.xhtml">
       <ui:define name="label">Serialized?</ui:define>
       <h:selectBooleanCheckbox value="#{Keys.key.serialized}" id="serialized">
       <a:support id="serializedUpdate" event="onclick" reRender="serialize"/>
       </h:selectBooleanCheckbox>
       </s:decorate>
       </a:region>
       <a:outputPanel id="serialize">
       <s:decorate id="rangeDecoration" template="/layout/edit.xhtml">
       <ui:define name="label">Range of Serialized Keys</ui:define>
       <h:inputText id="range" required="#{Keys.key.serialized}"
       value="#{Keys.key.range}" disabled="#{!Keys.key.serialized}"/>
       </s:decorate>
       <s:decorate id="qtyDecoration" template="/layout/edit.xhtml">
       <ui:define name="label">Total Quantity</ui:define>
       <h:inputText id="qty" required="#{!Keys.key.serialized}"
       value="#{Keys.key.qty}" disabled="#{Keys.key.serialized}"/>
       </s:decorate>
       </a:outputPanel>
       </a:region>
      


      I have tried many different combinations including limitToList on the support tag, setting the ajaxRendered on the outputPanel, and getting rid of the regions and setting ajaxSingle on the support tag. (I am probably missing several attempts.)

      Google hasn't been helpful (or I haven't found the right search terms). As I haven't used Ajax before, I suspect I am overlooking something glaringly obvious. Does anyone have an idea what I am doing wrong?

      (Since someone may well suggest this, I'd like to use Ajax for this problem instead of straight javascript. Since I am also updating the required fields using seam decorate, I'd just as soon avoid manually modifying the required span within the control areas.)

      Thanks,
      Paul Scheible

        • 1. Re: A4J refreshing entire page instead of specified area
          scheible

          Well, I resolved the issue. The form in question was part of a pageflow. The form had a default transition associated with it. That transition moved to a decision that checked for a successful save and returned to the form if it failed. The Ajax request triggered that default transition. By naming the transition and making appropriate changes to the session bean, the specified area was properly refreshed.

          Paul Scheible