1 Reply Latest reply on Sep 13, 2010 4:09 PM by lholmquist

    Bean setter not getting called on a4j:form submit

    lholmquist

      Hello,

       

      I'm having an issue when i submit a form with the a4j:commandButton.  The page is set up as follows.  The top section has a richDataTable that displays a list of things.  each row has a a4j:commandLink that will load and then rerender the bottom section of the page.    this part works fine

       

      the bottom section has an inputText field and a button to submit it .   The problem is that when i submit the bottom section using an a4j:commandButton,  the set method is never called for that field so in the action method, i see that the field never gets the new value.  but if i change the button to just a regular h:commandButton,  it works, but the whole page gets refreshed.

       

      at the very top of this page, i created a small a4j: form with some input fields and submitted with the a4j:commandButton,  and that did work

       

       

       

      any help would be appreciated.

       

      code below:

       

       

      package org.crm.action;
      
      import org.apache.fop.apps.Fop;
      import org.apache.fop.apps.FopFactory;
      import org.apache.fop.apps.MimeConstants;
      import org.crm.beans.LoggedInUser;
      import org.crm.beans.RM.RMCourse;
      import org.crm.beans.WbAuthorized;
      import org.crm.beans.WbReservation;
      import org.crm.util.DataBaseLayer;
      import org.crm.util.XmlUtil;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.*;
      import org.jboss.seam.annotations.datamodel.DataModel;
      import org.jboss.seam.annotations.datamodel.DataModelSelection;
      import org.jboss.seam.international.StatusMessages;
      import org.jboss.seam.log.Log;
      
      import javax.faces.context.FacesContext;
      import javax.servlet.ServletContext;
      import javax.servlet.ServletOutputStream;
      import javax.servlet.http.HttpServletResponse;
      import javax.xml.transform.Result;
      import javax.xml.transform.Source;
      import javax.xml.transform.Transformer;
      import javax.xml.transform.TransformerFactory;
      import javax.xml.transform.sax.SAXResult;
      import javax.xml.transform.stream.StreamSource;
      import java.io.ByteArrayInputStream;
      import java.io.ByteArrayOutputStream;
      import java.io.File;
      import java.io.IOException;
      import java.text.DateFormat;
      import java.util.Date;
      import java.util.List;
      
      /**
       * Created by IntelliJ IDEA.
       * User: lholmquist
       * Date: May 6, 2010
       * Time: 3:36:29 PM
       */
      
      @Name("rmDetail")
      public class RmDetail {
      
      
          @Logger
          private Log log;
      
          @In
          StatusMessages statusMessages;
      
          @In
          LoggedInUser loggedUser;
      
          @In
          WbAuthorized wbAuth;
      
          DataBaseLayer db = new DataBaseLayer();
      
          @In(required = false) @Out(required = false,scope = ScopeType.CONVERSATION)
          RMCourse rmCourse;
      
      
          @Out(required = false)
          WbReservation wbReservation;
      
          @DataModel(scope = ScopeType.PAGE)
          List<WbReservation> userWebReservationListForRM;
      
          @DataModelSelection(value = "userWebReservationListForRM")
          WbReservation selectedWebReservation;
      
      
          public void SelectCourseForDetailView(int reservationId,String offeringCode)
          {
                //get information
                rmCourse = db.GetRmCourse(reservationId,offeringCode);
                wbReservation = selectedWebReservation;
      
          }
      
        
          @Factory("userWebReservationListForRM")
          public void GetUserWebReservationList()
          {
      
              userWebReservationListForRM = db.GetOfferingsForUser("RM", wbAuth.getExternalId());
      
              rmCourse = db.GetRmCourse(userWebReservationListForRM.get(0).getReservationId(),userWebReservationListForRM.get(0).getOffering().getOfferingCode());
              wbReservation = userWebReservationListForRM.get(0);
      
          }
      
       
      
          public void UpdateLessonLocation(RMCourse selectedRmCourse)
          {
              System.out.println("Updating Lesson Location");
              String newLocation = rmCourse.getLessonLoction();
              String newLocation1 = selectedRmCourse.getLessonLoction();
          
              rmCourse.getSco().core.setLessonLocation(newLocation);
              db.UpdateScoData(rmCourse);
      
              System.out.println("add observer here");
      
          }
      
          
      
      
      }
      
      

       

      <h:form id="programHistoryForm">
                      <fieldset>
      
                          <legend class="legend">Program History</legend>
                          <br/>
                          <br/>
      
                          <rich:dataTable value="#{userWebReservationListForRM}" var="_cl" id="programTable">
                              <rich:column>
                                  <f:facet name="header">Actions</f:facet>
                                  <a:commandLink value="Detail" action="#{rmDetail.SelectCourseForDetailView(_cl.reservationId,_cl.offering.offeringCode)}" reRender="courseDetailPanel" ajaxSingle="true"/>
                              </rich:column>
                              <rich:column>
                                  <f:facet name="header">Program</f:facet>
                                  <h:outputText value="#{_cl.offering.offeringDescription}"/>
                              </rich:column>
                              <rich:column>
                                  <f:facet name="header">Status</f:facet>
                                  <h:outputText value="#{_cl.status}"/>
                              </rich:column>
                              <rich:column>
                                  <f:facet name="header">Registered Date</f:facet>
                                  <h:outputText value="#{_cl.createDate}"/>
                              </rich:column>
                              <rich:column>
                                  <f:facet name="header">Completed Date</f:facet>
                                  <h:outputText value="#{_cl.completedDate}"/>
                              </rich:column>
                          </rich:dataTable>
      
                      </fieldset>
                  </h:form>
      
                  <br/>
                  <br/>
      
                  <h:panelGroup id="courseDetailPanel">
                  <a:form id="cdpForm">
      
                      <fieldset>
                          <legend class="legend">Course Detail</legend>
                           <br/>
                          <rich:layout>
                              <rich:layoutPanel position="top" width="100%">
                                <h:outputText value="#{wbReservation.offering.offeringDescription}"/>  
                              </rich:layoutPanel>
                          </rich:layout>
                          <table width="100%">
                              <tr>
                                  <td width="50%">
                                      <table width="100%">
                                          <tr>
                                              <td>
                                                <fieldset class="fieldSet">
                                                      <legend class="legend">Registration Info</legend>
                                                      <br/>
                                                      <br/>
                                                    <h:panelGroup id="registeredPanel" rendered="#{wbReservation.reserved}">
                                                       <!--A Registration has already happened -->
                                                        Registered
                                                        <br/>
                                                        Click to Cancel the reg
                                                    </h:panelGroup>
      
                                                    <h:panelGroup id="nonRegPanel" rendered="#{not wbReservation.reserved}">
                                                        <!-- Registration hasn't happend yet -->
                                                      Not Yet Registered
                                                        <br/>
                                                        Click here to register
                                                    </h:panelGroup>
      
                                                  </fieldset>
                                             </td>
                                          </tr>
                                      </table>
                                  </td>
                                  <td width="50%">
                                      <table width="100%">
                                          <tr>
                                              <td>
                                                  <fieldset>
                                                  <legend class="legend">Course Info</legend>
                                                  <br/>
                                                  <br/>
                                                   <h:panelGroup id="coursePanel">
                                                    <b>Current Status:</b><h:outputText value="#{rmCourse.status}"/>
                                                       <br/>
                                                     <b>Total Learning Time:</b><h:outputText value="#{rmCourse.sco.core.totalTime}"/>
                                                      <br/>
                                                       <b>Last Accessed Date:</b><h:outputText value="#{rmCourse.lastAccessDate}" />
                                                       <br/>
                                                       <h:panelGroup rendered="#{not wbReservation.complete}">
      
      
                                                              <b>Lesson Location:</b>
                                                               <h:inputText id="locationText"  value="#{rmCourse.lessonLoction}"/>
                                                               <a:commandButton value="update" action="#{rmDetail.UpdateLessonLocation}" reRender="coursePanel" ajaxSingle="true"/>
      
      
                                                             <b>Expires On</b>
                                                                <rich:calendar value="#{rmCourse.expiresOnDate}"/>
                                                                <a:commandButton value="update Date" action="#{rmDetail.UpdateExpiresOn}" reRender="coursePanel" ajaxSingle="true"/>
                                                          
                                                       </h:panelGroup>
      
      
      
                                                   </h:panelGroup>
      
                                                   <h:panelGroup id="notCompletedCoursePanel" rendered="#{not wbReservation.complete}">
                                                     <!--COurse hasnt been completed Yet,  also handle expired -->  
                                                   </h:panelGroup>
                                              </fieldset>
                                              </td>
                                          </tr>
                                      </table>
                                  </td>
                              </tr>
                          </table>
      
                      </fieldset>
      
                   </a:form>
                  </h:panelGroup>