1 Reply Latest reply on Aug 16, 2008 3:45 PM by quaidbrown

    a4j:commandButton does nothing on first click

      When I click the button the first time, nothing happens. I stdout some text in the addDegree method that doesn't happen on the first click. I can put a javascript alert on the button, and it alerts the first time, and on subsequent clicks.

      The second click works fine, the data table updates with the added degree name. Any idea what is causing this?

      <rich:simpleTogglePanel switchType="client"
       label="Institution Information" height="150px" opened="false">
       <f:facet name="closeMarker">
       <h:graphicImage value="stylesheet/css-images/PnlHdr_down.gif" />
       </f:facet>
       <f:facet name="openMarker">
       <h:graphicImage value="stylesheet/css-images/PnlHdr_collapsed.gif" />
       </f:facet>
      
       <rich:dataTable value="#{orgApplication.degrees}" var="curDegree"
       width="750" id="degreeTable">
      
       <f:facet name="header">
       <h:outputText value="Applicant Academic Background"></h:outputText>
       </f:facet>
       <rich:column>
       <f:facet name="header">Degree Name</f:facet>
       <h:outputText value="#{curDegree.degreeName}" />
       </rich:column>
       </rich:dataTable>
      
       <a4j:form>
       <h:inputText value="#{orgApplicationBean.degree.degreeName}" />
       <a4j:commandButton value="Add Degree" reRender="degreeTable" action="#{orgApplicationBean.addDegree}" />
       </a4j:form>
      </rich:simpleTogglePanel>


      @Stateful
      @Name("orgApplicationBean")
      @Scope(ScopeType.SESSION)
      public class OrgApplicationBackingBean implements OrgApplication{
      
       @In
       FacesMessages facesMessages;
      
       Degree degree = new Degree();
      
       @PersistenceContext
       EntityManager entityManager;
      
      
       OrganizationApplication organizationApplication = new OrganizationApplication();
      
       @Create
       public void createMethod(){
       System.out.println("Creating orgapplicationbean");
       }
      
      
       @Remove @Destroy
       public void destroy(){
      
       }
      
       public void validateApplication(){
       facesMessages.add("validated");
       }
      
      
       public void addDegree(){
       System.out.println("in addDegree " + degree);
       if(degree != null){
       System.out.println("adding degree " + degree.getDegreeName());
       organizationApplication.addDegree(degree);
       System.out.println("size: " + organizationApplication.getDegrees().size());
       degree = new Degree();
       }
       }
      
       public Degree getDegree() {
       return degree;
       }
      
       public void setDegree(Degree degree) {
       this.degree = degree;
       }
      
       public OrganizationApplication getOrganizationApplication() {
       return organizationApplication;
       }
      
       public void setOrganizationApplication(
       OrganizationApplication organizationApplication) {
       this.organizationApplication = organizationApplication;
       }
      }
      
      



      public interface OrgApplication {
       public void destroy();
       public OrganizationApplication getOrganizationApplication();
       public void addDegree();
       public Degree getDegree();
       public void createMethod();
      }