1 Reply Latest reply on Feb 8, 2008 8:17 PM by thinkblue146

    A4J doesn't update after JSF validation errors

    thinkblue146

      Hello All,

      I was hoping you could help me out with this issue that Im having with updating an A4J output panel after JSF validation errors have kicked off... So first I will give you the scenario that works:

      1) User comes to the form enters tech number and hits find
      2) Form updates the section for first/last name.
      3) user enters the account number and hits Find
      4) Form updates the address section of the page
      5) User manually enters the rest of the fields and submits the form.

      This all works fine until this scenario happens:

      1) User comes to the page and clicks the Save/submit button.
      2) Form returns with all the the required="true" fields flagged with error messages.
      3) User enters tech number and hits find
      4) Form updates the section for first/last name.
      5) user enters the account number and hits Find
      6) Form updates the address section of the page...But only the fields that were flagged as required="true" come back with data...Where before all the data came back.

      I will stop there because this is where I need some help...Below is the xhtml code that I have so far:

      
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       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"
       template="template.xhtml">
      
       <ui:define name="content">
       <div id="formContent">
       <h:form id="loadData">
       <a4j:log hotkey="M"/>
       <a4j:outputPanel id="globalErrors" ajaxRendered="true">
       <h:messages styleClass="errors" globalOnly="true" />
       </a4j:outputPanel>
       <s:validateAll>
       <a4j:outputPanel id="findTechByTechNumber">
       <a4j:region>
       <div id="techSearch">
       <label>*Tech Number:</label>
       <div class="input">
       <a4j:outputPanel ajaxRendered="true">
       <h:inputText id="dtTechNumber" maxlength="5" value="#{disasterTracking.dtTechNumber}" required="true" />
       <h:message for="dtTechNumber" styleClass="errors" />
       </a4j:outputPanel>
       </div>
       <div class="button">
      
       <a4j:commandButton value="FIND" action="#{disasterTrackingManagerBean.loadTechByTechNumber}" reRender="findTechByTechNumber" />
      
       </div>
       </div>
       </a4j:region>
      
       <div id="techData">
       <div id="techSearchLeftSide">
       <label>*Tech First Name:</label>
       <div class="input">
       <a4j:outputPanel ajaxRendered="true">
       <h:inputText id="dtTechFname" maxlength="25" value="#{disasterTracking.dtTechFname}" required="true" />
       <h:message for="dtTechFname" styleClass="errors" />
       </a4j:outputPanel>
       </div>
       </div>
      
       <div id="techSearchRightSide">
       <label>*Tech Last Name:</label>
       <div class="input">
       <a4j:outputPanel ajaxRendered="true">
       <h:inputText id="dtTechLname" maxlength="50" value="#{disasterTracking.dtTechLname}" required="true" />
       <h:message for="dtTechLname" styleClass="errors" />
       </a4j:outputPanel>
       </div>
       </div>
       </div>
       </a4j:outputPanel>
      
      
      
      
      
       <a4j:outputPanel id="findAddressByAccountNumber">
      
       <div id="accountSearch">
       <label>Account Number:</label>
       <a4j:region immediate="true">
       <div class="input">
       <h:inputText id="dtAcctNbr" maxlength="8" value="#{disasterTracking.dtAcctNbr}" />
       <h:message for="dtAcctNbr" styleClass="errors" />
       </div>
       <div class="button">
      
       <a4j:commandButton value="FIND" action="#{disasterTrackingManagerBean.loadAddressByAccountNumber}" reRender="findAddressByAccountNumber" />
      
       </div>
       </a4j:region>
       </div>
      
      
      
       <div id="houseInformation1">
       <div id="Address">
       <label>*Address:</label>
       <div class="input">
       <h:inputText id="dtAddress" maxlength="36" value="#{disasterTracking.dtAddress}" required="true" />
       <h:message for="dtAddress" styleClass="errors" />
       </div>
       </div>
      
       <div id="Apartment">
       <label>Apartment Number:</label>
       <div class="input">
      
       <h:inputText id="dtAptNbr" maxlength="10" value="#{disasterTracking.dtAptNbr}" />
       <h:message for="dtAptNbr" styleClass="errors" />
      
       </div>
       </div>
      
       </div>
      
       <div id="houseInformation2">
       <div id="City">
       <label>*City:</label>
       <div class="input">
       <h:inputText id="dtCity" maxlength="25" value="#{disasterTracking.dtCity}" required="true" />
       <h:message for="dtCity" styleClass="errors" />
       </div>
       </div>
      
       <div id="State">
       <label>*State:</label>
       <div class="input">
       <h:inputText id="dtState" maxlength="2" value="#{disasterTracking.dtState}" required="true" />
       <h:message for="dtState" styleClass="errors" />
       </div>
       </div>
      
       <div id="Zipcode">
       <label>*Zipcode:</label>
       <div class="input">
       <h:inputText id="dtZip" maxlength="5" value="#{disasterTracking.dtZip}" required="true" />
       <h:message for="dtZip" styleClass="errors" />
       </div>
       </div>
       </div>
      
       <div id="houseInformation3">
       <div id="Node">
       <label>Node:</label>
       <div class="input">
       <h:inputText id="dtNode" maxlength="5" value="#{disasterTracking.dtNode}" />
       <h:message for="dtNode" styleClass="errors" />
       </div>
       </div>
      
       <div id="DropType">
       <label>*Drop Type</label>
       <div class="input">
       <h:selectOneMenu id="dropType" value="#{disasterTracking.dropType}" required="true">
       <s:selectItems value="#{allDropTypes.resultList}" var="currentDropType" label="#{currentDropType.drtDesc}" noSelectionLabel="Please Select..." />
       <s:convertEntity />
       </h:selectOneMenu>
       <h:message for="dropType" styleClass="errors" />
       </div>
       </div>
       </div>
       </a4j:outputPanel>
      
       <a4j:outputPanel>
       <div id="houseInformation4">
       <div id="AccountType">
       <label>*Account Type</label>
       <div class="input">
       <h:selectOneMenu id="accountType" value="#{disasterTracking.accountType}" required="true">
       <s:selectItems value="#{allAccountTypes.resultList}" var="currentAccountType" label="#{currentAccountType.atDesc}" noSelectionLabel="Please Select..." />
       <s:convertEntity />
       </h:selectOneMenu>
       <h:message for="accountType" styleClass="errors" />
       </div>
       </div>
      
       <div id="HouseStatusType">
       <label>*House Status Type</label>
       <div class="input">
       <h:selectOneMenu id="houseStatusType" value="#{disasterTracking.houseStatusType}" required="true">
       <s:selectItems value="#{allHouseStatusTypes.resultList}" var="currentHouseStatusType" label="#{currentHouseStatusType.hstDesc}" noSelectionLabel="Please Select..." />
       <s:convertEntity />
       </h:selectOneMenu>
       <h:message for="houseStatusType" styleClass="errors" />
       </div>
       </div>
       </div>
      
      
       <div id="houseInformation5">
       <div id="DropStatusType">
       <label>*Drop Status Type</label>
       <div class="input">
       <h:selectOneMenu id="dropStatusType" value="#{disasterTracking.dropStatusType}" required="true">
       <s:selectItems value="#{allDropStatusTypes.resultList}" var="currentDropStatusType" label="#{currentDropStatusType.dstDesc}" noSelectionLabel="Please Select..." />
       <s:convertEntity />
       </h:selectOneMenu>
       <h:message for="dropStatusType" styleClass="errors" />
       </div>
       </div>
      
       <div id="Checkboxes">
       <div id="CpeFields">
       <label>*CPE DAMAGE/REMOVED:</label>
       <h:selectOneRadio id="dtCpeDamaged" value="#{disasterTracking.dtCpeDamaged}" required="true" >
       <f:selectItem itemValue="Y" itemLabel="Yes"/>
       <f:selectItem itemValue="N" itemLabel="No"/>
       </h:selectOneRadio>
       <h:message for="dropStatusType" styleClass="errors" />
       </div>
      
       <div id="CpeFields">
       <label>*CPE RECOVERED:</label>
       <h:selectOneRadio id="dtCpeRecovered" value="#{disasterTracking.dtCpeRecovered}" >
       <f:selectItem itemValue="Y" itemLabel="Yes"/>
       <f:selectItem itemValue="N" itemLabel="No"/>
       </h:selectOneRadio>
       <h:message for="dropStatusType" styleClass="errors" />
       </div>
      
       <div id="CpeFields">
       <label>*CPE INSTALLED:</label>
       <h:selectOneRadio id="dtCpeInstalled" value="#{disasterTracking.dtCpeInstalled}" >
       <f:selectItem itemValue="Y" itemLabel="Yes"/>
       <f:selectItem itemValue="N" itemLabel="No"/>
       </h:selectOneRadio>
       <h:message for="dropStatusType" styleClass="errors" />
       </div>
       </div>
       </div>
      
       <div id="houseInformation6">
       <div id="JobDuration">
       <label>*Job Duration (IN MINUTES):</label>
       <div class="input">
       <h:inputText id="dtJobDuration" maxlength="8" value="#{disasterTracking.dtJobDuration}" required="true" />
       <h:message for="dtJobDuration" styleClass="errors" />
       </div>
       </div>
       </div>
      
       <div id="houseInformation7">
       <div id="Comments">
       <label>Comments:</label>
       <div class="input">
       <h:inputTextarea id="dtComments" rows="8" maxlength="1000" value="#{disasterTracking.dtComments}" />
       <h:message for="dtComments" styleClass="errors" />
       </div>
       </div>
       </div>
       </a4j:outputPanel>
       </s:validateAll>
       <div id="buttonSection">
       <div class="button">
       <h:commandButton id="save" value="SAVE" action="#{disasterTrackingManagerBean.persist}" />
       </div>
       </div>
      
       </h:form>
       </div>
       </ui:define>
      
      </ui:composition>
      


      If you have any Idea of what I'm doing incorrectly in my code please help me out.

      Thank you

      Blue