5 Replies Latest reply on Feb 7, 2009 9:13 PM by bjorntj

    Strange input problem using ajax?

    bjorntj

      I have the following code in my xhtml file..:

      <h:inputText id="observerstedskode" value="#{observBean.chosenObserv.lok}" size="20" maxlength="4"
       <a4j:support event="onblur" reRender="observExtraInfo" ajaxSingle="true" limitToList="true"/>
       <f:validateLength maximum="4"/>
       </h:inputText>
      


      When leaving the field, the observExtrainfo panel is rerendered but the problem is that the value I am checking in my manage bean (observBean.chosenObserv.lok) is not updated.. Or when the length of the string in lok is > 0 then lok has the correct value. But when I delete the value in my form and leave the field, the lok value still has the old value instead of an empty value, which makes my lookup not work...

      What am I missing? Shouldn't lok be emtpy when rerendering the page as long as the input value field is empty?


      Regards,

      BTJ


        • 1. Re: Strange input problem using ajax?
          tsurdilovic

          Show your xhtml , backing bean code and faces-config. The onblur event should fire regardless of the value in observerstedskode.

          • 2. Re: Strange input problem using ajax?
            bjorntj

             

            "tsurdilovic" wrote:
            Show your xhtml , backing bean code and faces-config. The onblur event should fire regardless of the value in observerstedskode.


            The onblur event is fired but the value of observBean.chosenObserv.lok is not updated when the inputfield is for lok is cleared...

            BTJ

            • 3. Re: Strange input problem using ajax?
              tsurdilovic

               

              "bjorntj" wrote:


              The onblur event is fired but the value of observBean.chosenObserv.lok is not updated when the inputfield is for lok is cleared...

              BTJ


              Ran a simple example based on provided xhtml and it ran fine..that's why I mentioned for you to show more code :)

              • 4. Re: Strange input problem using ajax?
                bjorntj

                Hmmm... Ok then... :) (it's just a lot of code...)

                xhtml file:

                <?xml version="1.0" encoding="ISO-8859-1"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:a4j="http://richfaces.org/a4j"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:h="http://java.sun.com/jsf/html">
                
                <body>
                <ui:composition template="../common/layout.xhtml">
                 <ui:define name="top">
                 <ui:include src="../common/header.xhtml"/>
                 </ui:define>
                 <ui:define name="content">
                 <br/>
                 <h:form id="frmgaas">
                 <rich:tabPanel id="gaastabpanel" switchType="ajax" selectedTab="#{gaasBean.selectedTab}" width="800px">
                 <rich:tab id="tabGaasAll" label="#{gaasBean.rowCount}" actionListener="#{gaasBean.refreshTable}" disabled="#{gaasBean.tabAllDisabled}">
                 <rich:dataTable
                 onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                 onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
                 id="gaastable" value="#{gaasPaginationService}" var="gaas" rows="20" width="950">
                 <f:facet name="footer">
                 <rich:datascroller for="gaastable" fastStep="10" eventsQueue="gaasEventsQueue" requestDelay="250" page="#{gaasBean.scrollerPage}" ignoreDupResponses="true" binding="#{gaasBean.datascroller}"/>
                 </f:facet>
                 <f:facet name="header">
                 <rich:columnGroup>
                 <!--<rich:column>
                 <h:outputText styleClass="headerText" value=""/>
                 </rich:column>-->
                 <rich:column>
                 <a4j:commandLink value="#{msgs.FootRing}" styleClass="headerText" reRender="gaastable"
                 actionListener="#{gaasBean.sortTable}">
                 <a4j:actionparam name="sortField" value="fotring"/>
                 </a4j:commandLink>
                 </rich:column>
                 <rich:column>
                 <a4j:commandLink value="#{msgs.NeckRing}" styleClass="headerText" reRender="gaastable"
                 actionListener="#{gaasBean.sortTable}">
                 <a4j:actionparam name="sortField" value="halsring"/>
                 </a4j:commandLink>
                 </rich:column>
                 <rich:column>
                 <a4j:commandLink value="#{msgs.Date}" styleClass="headerText" reRender="gaastable" actionListener="#{gaasBean.sortTable}">
                 <a4j:actionparam name="sortField" value="dato"/>
                 </a4j:commandLink>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Weigth}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Nebb}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Skalle}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Fjaer1}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Fjaer2}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Fjaer3}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.BlackFeather}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Sex}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Tars}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Marked}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText styleClass="headerText" value="#{msgs.Comment}"/>
                 </rich:column>
                 </rich:columnGroup>
                 </f:facet>
                 <!--<rich:column>
                 <h:outputText value="#{rowIndex}"/>
                 </rich:column>-->
                 <rich:column>
                 <h:outputText id="fotring" value="#{gaas.fotring}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="halsring" value="#{gaas.halsring}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="dato" value="#{gaas.datoString}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="vekt" value="#{gaas.vekt}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="nebb" value="#{gaas.nebb}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="skalle" value="#{gaas.skalle}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="fjaer1" value="#{gaas.fjaer1}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="fjaer2" value="#{gaas.fjaer2}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="fjaer3" value="#{gaas.fjaer3}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="svartfj" value="#{gaas.svartfj}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="sex" value="#{gaas.sex}"/>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="tars" value="#{gaas.tars}">
                 <f:converter converterId="no.havleik.Double"/>
                 </h:outputText>
                 </rich:column>
                 <rich:column>
                 <h:outputText id="merket" value="#{gaas.merket}"/>
                 </rich:column>
                 <rich:column style="tezxt-align: center">
                 <h:outputText id="kommentar" value="#{gaas.comment}"/>
                 <rich:toolTip direction="bottom-right" mode="ajax" showDelay="300" styleClass="tooltip" layout="block" rendered="#{gaas.commentTooltip}">
                 <h:panelGrid columns="2">
                 <h:outputText value="#{msgs.Comment}:" style="font-weight: bold"/>
                 <h:outputText value="#{gaas.kommentar}" styleClass="tooltipData" />
                 </h:panelGrid>
                 </rich:toolTip>
                 </rich:column>
                 <rich:componentControl event="onRowClick" for="contextmenu" operation="show" rendered="#{gaasBean.writePermission}">
                 <f:param value="#{gaas.id}" name="rowId"/>
                 </rich:componentControl>
                 </rich:dataTable>
                 <rich:contextMenu attached="false" submitMode="ajax" id="contextmenu">
                 <rich:menuItem value="#{msgs.ChangeGoose}" action="#{gaasBean.edit}" reRender="gaastabpanel" focus="gaasfotring">
                 <f:param value="{rowId}" name="gaasRowId"/>
                 </rich:menuItem>
                 <rich:menuItem value="#{msgs.DeleteGoose}" actionListener="#{gaasBean.delete}">
                 <f:param value="{rowId}" name="gaasRowId"/>
                 </rich:menuItem>
                 </rich:contextMenu>
                 </rich:tab>
                 <rich:tab id="tabGaasNew" label="#{gaasBean.tabNewLabel}" disabled="#{gaasBean.tabNewDisabled}">
                 <h:panelGrid id="pangaas" columns="2" columnClasses="gridContent" >
                 <rich:panel bodyClass="inpanelBody">
                 <f:facet name="header">
                 <h:outputText value="#{msgs.Information}"/>
                 </f:facet>
                 <h:panelGrid id="gaaspanelgrid" columns="3">
                 <h:outputText value="*#{msgs.FootRing}:" style="font-weight: bold"/>
                 <h:inputText id="gaasfotring" value="#{gaasBean.chosenGaas.fotring}" size="20" maxlength="7"
                 tabindex="0"
                 required="true"
                 requiredMessage="#{msgs.FotringRequired}">
                 <!--validatorMessage="Lengde må være på max 7 tegn">-->
                 <!--<f:validateLength maximum="7" minimum="7"/>-->
                 <f:validator validatorId="no.havleik.Fotring"/>
                 <rich:ajaxValidator event="onblur"/>
                 </h:inputText>
                 <rich:message for="gaasfotring">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="*#{msgs.NeckRing}:" style="font-weight: bold"/>
                 <h:inputText id="gaashalsring" value="#{gaasBean.chosenGaas.halsring}" size="20" maxlength="3" tabindex="1">
                 <!--required="true"
                 requiredMessage="#{msgs.HalsringRequired}">-->
                 <!--validatorMessage="Lengde må være på 3 tegn">-->
                 <!--<f:validateLength maximum="3" minimum="3"/>-->
                 <f:validator validatorId="no.havleik.Halsring"/>
                 <rich:ajaxValidator event="onblur"/>
                 </h:inputText>
                 <rich:message for="gaashalsring">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="*#{msgs.Date}:" style="font-weight: bold"/>
                 <rich:calendar id="gaasdato" value="#{gaasBean.chosenGaas.dato}"
                 locale="#{gaasBean.locale}"
                 popup="true"
                 datePattern="#{gaasBean.datePatternGaas}"
                 defaultTime="00:00"
                 required="true"
                 requiredMessage="#{msgs.DateRequired}"
                 converterMessage="#{msgs.DateInvalid}"
                 showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px"/>
                 <rich:message for="gaasdato">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Weigth}:" style="font-weight: bold"/>
                 <h:inputText id="gaasvekt" value="#{gaasBean.chosenGaas.vekt}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 7 tegn">
                 <f:validateLength maximum="10"/>
                 <rich:ajaxValidator event="onblur"/>
                 <!--<a4j:support event="onblur" reRender="pangaas" ajaxSingle="true" limitToList="true"/>-->
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaasvekt">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Nebb}:" style="font-weight: bold"/>
                 <h:inputText id="gaasnebb" value="#{gaasBean.chosenGaas.nebb}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 10 tegn">
                 <f:validateLength maximum="10"/>
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaasnebb">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Skalle}:" style="font-weight: bold"/>
                 <h:inputText id="gaasskalle" value="#{gaasBean.chosenGaas.skalle}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 10 tegn">
                 <f:validateLength maximum="10"/>
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaasskalle">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Fjaer1}:" style="font-weight: bold"/>
                 <h:inputText id="gaasfjaer1" value="#{gaasBean.chosenGaas.fjaer1}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 10 tegn">
                 <f:validateLength maximum="10"/>
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaasfjaer1">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Fjaer2}:" style="font-weight: bold"/>
                 <h:inputText id="gaasfjaer2" value="#{gaasBean.chosenGaas.fjaer2}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 10 tegn">
                 <f:validateLength maximum="10"/>
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaasfjaer2">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Fjaer3}:" style="font-weight: bold"/>
                 <h:inputText id="gaasfjaer3" value="#{gaasBean.chosenGaas.fjaer3}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 10 tegn">
                 <f:validateLength maximum="10"/>
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaasfjaer3">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.BlackFeather}:" style="font-weight: bold"/>
                 <h:inputText id="gaassvfjaer" value="#{gaasBean.chosenGaas.svartfj}" size="20" maxlength="15"
                 validatorMessage="Lengde må være på max 15 tegn">
                 <f:validateLength maximum="15"/>
                 </h:inputText>
                 <rich:message for="gaassvfjaer">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Sex}:" style="font-weight: bold"/>
                 <h:inputText id="gaassex" value="#{gaasBean.chosenGaas.sex}" size="20" maxlength="5"
                 validatorMessage="Lengde må være på max 5 tegn">
                 <f:validateLength maximum="5"/>
                 </h:inputText>
                 <rich:message for="gaassex">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Tars}:" style="font-weight: bold"/>
                 <h:inputText id="gaastars" value="#{gaasBean.chosenGaas.tars}" size="20" maxlength="10"
                 converterMessage="#{msgs.NumberInvalid}"
                 validatorMessage="Lengde må være på max 10 tegn">
                 <f:validateLength maximum="10"/>
                 <f:converter converterId="no.havleik.Double"/>
                 </h:inputText>
                 <rich:message for="gaastars">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Marked}:" style="font-weight: bold"/>
                 <h:inputText id="gaasmerket" value="#{gaasBean.chosenGaas.merket}" size="50" maxlength="50"
                 validatorMessage="Lengde må være på max 50 tegn">
                 <f:validateLength maximum="50"/>
                 </h:inputText>
                 <rich:message for="gaasmerket">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <h:outputText value="#{msgs.Comment}:" style="font-weight: bold"/>
                 <h:inputText id="gaaskommentar" value="#{gaasBean.chosenGaas.kommentar}" size="50" maxlength="50"
                 validatorMessage="Lengde må være på max 50 tegn">
                 <f:validateLength maximum="50"/>
                 </h:inputText>
                 <rich:message for="gaaskommentar">
                 <f:facet name="passedMarker">
                 <h:graphicImage value="/secure/images/passed.gif"/>
                 </f:facet>
                 <f:facet name="errorMarker">
                 <h:graphicImage value="/secure/images/error.gif"/>
                 </f:facet>
                 </rich:message>
                 <rich:spacer height="40px"/>
                 <rich:spacer height="40px"/>
                 <rich:spacer height="40px" width="150px"/>
                 </h:panelGrid>
                 <h:panelGroup>
                 <a4j:commandButton action="#{gaasBean.save}" value="#{msgs.Save}" reRender="gaastabpanel"/>
                 <rich:spacer width="20px"/>
                 <a4j:commandButton action="#{gaasBean.cancelEdit}" value="#{msgs.Cancel}" reRender="gaastabpanel" ajaxSingle="true"/>
                 </h:panelGroup>
                 </rich:panel>
                 <h:panelGroup>
                 <rich:panel id="gaasExtraInfo" bodyClass="inpanelBody">
                 <f:facet name="header">
                 <h:outputText value="#{msgs.AddedInfo}"/>
                 </f:facet>
                 <h:panelGrid columns="2" style="white-space: nowrap">
                 <h:outputText value="#{msgs.Created}:" style="font-weight: bold"/>
                 <h:inputText value="#{gaasBean.chosenGaas.createdString}" size="20" maxlength="20" readonly="true"/>
                 <h:outputText value="#{msgs.CreatedBy}:" style="font-weight: bold"/>
                 <h:inputText value="#{gaasBean.chosenGaas.createdby}" size="20" maxlength="20" readonly="true"/>
                 <h:outputText value="#{msgs.Modified}:" style="font-weight: bold"/>
                 <h:inputText value="#{gaasBean.chosenGaas.modifiedString}" size="20" maxlength="20" readonly="true"/>
                 <h:outputText value="#{msgs.ModifiedBy}:" style="font-weight: bold"/>
                 <h:inputText value="#{gaasBean.chosenGaas.modifiedby}" size="20" maxlength="20" readonly="true"/>
                 </h:panelGrid>
                 </rich:panel>
                 <rich:spacer height="273px"/>
                 </h:panelGroup>
                 </h:panelGrid>
                 </rich:tab>
                 <rich:tab id="tabGaasSearch" label="#{msgs.Search}" disabled="#{gaasBean.tabSearchDisabled}" actionListener="#{gaasBean.initSearch}">
                 <rich:panel bodyClass="inpanelBody">
                 <f:facet name="header">
                 <h:outputText value="#{msgs.SearchCriteria}"/>
                 </f:facet>
                 <h:panelGrid id="searchpanelgrid" columns="3">
                 <h:outputText value="#{msgs.FootRing}/#{msgs.NeckRing}:" style="font-weight: bold"/>
                 <h:inputText id="searchfotring" value="#{gaasBean.searchBean.ring}" size="20" maxlength="7" tabindex="0"/>
                 <rich:message for="searchfotring"/>
                 <h:outputText value="#{msgs.FromDate}:" style="font-weight: bold"/>
                 <rich:calendar id="searchfromdato" value="#{gaasBean.searchBean.from}"
                 locale="#{gaasBean.locale}"
                 popup="true"
                 datePattern="#{gaasBean.datePatternGaas}"
                 defaultTime="00:00"
                 converterMessage="#{msgs.DateInvalid}"
                 showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px"/>
                 <rich:message for="searchfromdato"/>
                 <h:outputText value="#{msgs.ToDate}:" style="font-weight: bold"/>
                 <rich:calendar id="searchtodato" value="#{gaasBean.searchBean.to}"
                 locale="#{gaasBean.locale}"
                 popup="true"
                 datePattern="#{gaasBean.datePatternGaas}"
                 defaultTime="00:00"
                 converterMessage="#{msgs.DateInvalid}"
                 showApplyButton="false" cellWidth="24px" cellHeight="22px" style="width:200px"/>
                 <rich:message for="searchtodato"/>
                 <h:outputText value="#{msgs.Comment}:" style="font-weight: bold"/>
                 <h:inputText id="searchkommentar" value="#{gaasBean.searchBean.kommentar}" size="50" maxlength="50"/>
                 <rich:message for="searchkommentar"/>
                 <rich:spacer height="40px"/>
                 <rich:spacer height="40px"/>
                 <rich:spacer height="40px" width="150px"/>
                 </h:panelGrid>
                 <a4j:commandButton action="#{gaasBean.search}" value="#{msgs.Search}" reRender="gaastabpanel"/>
                 </rich:panel>
                 </rich:tab>
                 </rich:tabPanel>
                 <!--<rich:jQuery selector="frmgaas:gaasfotring" timing="onload" query="focus()" />-->
                 </h:form>
                 </ui:define>
                 <ui:define name="footer">
                 <ui:include src="../common/footer.xhtml"/>
                 </ui:define>
                </ui:composition>
                </body>
                </html>
                


                backing bean:
                package no.havleik.gaas.jsf;
                
                import no.havleik.gaas.services.GaasPaginationService;
                import no.havleik.gaas.services.GaasService;
                import no.havleik.gaas.services.AppConstants;
                import no.havleik.gaas.model.Gaas;
                import no.havleik.gaas.model.SearchBean;
                
                import javax.faces.event.ActionEvent;
                import javax.faces.context.FacesContext;
                
                import org.apache.commons.logging.Log;
                import org.apache.commons.logging.LogFactory;
                import org.richfaces.component.html.HtmlDataTable;
                import org.richfaces.component.html.HtmlDatascroller;
                import org.springframework.dao.DataIntegrityViolationException;
                
                /**
                 * Created by IntelliJ IDEA.
                 * User: Bjørn T Johansen
                 * Date: 01.02.2009
                 * Time: 14:26
                 */
                public class GaasBean extends BaseBean
                {
                 private static final long serialVersionUID = -3792677898408007755L;
                
                 private static final Log log = LogFactory.getLog(GaasBean.class);
                
                 private GaasPaginationService gaasPaginationService;
                
                 private GaasService gaasService;
                
                 private String selectedTab;
                
                 private boolean tabNewDisabled;
                
                 private boolean tabAllDisabled;
                
                 private boolean tabSearchDisabled;
                
                 private Long chosenId;
                
                 private Gaas chosenGaas;
                
                 private boolean edit;
                
                 private HtmlDataTable dataTable;
                
                 private HtmlDatascroller datascroller;
                
                 private Integer scrollerPage;
                
                 public GaasBean()
                 {
                 super();
                 }
                
                 public void init()
                 {
                 gaasPaginationService.init();
                 selectedTab = "tabGaasAll";
                 tabNewDisabled = true;
                 tabAllDisabled = false;
                 tabSearchDisabled = false;
                 edit = true;
                 scrollerPage = 1;
                 }
                
                 public void initNewGaas()
                 {
                 init();
                 edit = false;
                 selectedTab = "tabGaasNew";
                 tabNewDisabled = false;
                 tabAllDisabled = true;
                 tabSearchDisabled = true;
                 chosenId = -1L;
                 chosenGaas = new Gaas();
                 }
                
                 public void sortTable(ActionEvent event)
                 {
                 gaasPaginationService.initSorting();
                 scrollerPage = 1;
                 gaasPaginationService.setSortTable(true);
                 }
                
                 public void refreshTable(ActionEvent event)
                 {
                 gaasPaginationService.initSorting();
                 }
                
                 public void initSearch(ActionEvent event)
                 {
                 gaasPaginationService.getSearchBean().init();
                 }
                
                 public String edit()
                 {
                 final FacesContext context = FacesContext.getCurrentInstance();
                 String id = context.getExternalContext().getRequestParameterMap().get("gaasRowId");
                 if ((id == null) || (id.length() == 0))
                 {
                 log.fatal("id for gaas is not set, should not happend!");
                 addMsgError("Id ble ikke satt, skal ikke skje... Kontakt admininistrator med detaljer");
                 return null;
                 }
                
                 chosenId = Long.valueOf(id);
                 log.debug("Chosen id = " + chosenId);
                 tabNewDisabled = false;
                 tabAllDisabled = true;
                 tabSearchDisabled = true;
                 edit = true;
                 selectedTab = "tabGaasNew";
                 chosenGaas = gaasService.getGaas(chosenId);
                 return null;
                 }
                
                 public String cancelEdit()
                 {
                 tabNewDisabled = true;
                 tabAllDisabled = false;
                 tabSearchDisabled = false;
                 selectedTab = "tabGaasAll";
                 gaasPaginationService.initSorting();
                 return null;
                 }
                
                 public String save()
                 {
                 if (edit)
                 {
                 chosenGaas.setModifiedby(getUsername());
                 }
                 else
                 {
                 chosenGaas.setCreatedby(getUsername());
                 }
                 try
                 {
                 gaasService.update(chosenGaas);
                 if (edit)
                 {
                 addMsgInfo(getMessage("GooseUpdated"));
                 }
                 else
                 {
                 addMsgInfo(getMessage("GooseCreated"));
                 }
                 tabNewDisabled = true;
                 tabAllDisabled = false;
                 selectedTab = "tabGaasAll";
                 edit = true;
                 gaasPaginationService.initSorting();
                 }
                 catch (DataIntegrityViolationException e)
                 {
                 log.warn("DataIntegrityViolationException", e);
                 addMsgError(getMessage("GooseAlreadyUpdated"));
                 }
                 catch (Exception e)
                 {
                 log.error("Save of gaas failed", e);
                 addMsgError(getMessage("GooseUpdateFailed"));
                 }
                 return null;
                 }
                
                 public String getTabNewLabel()
                 {
                 if (edit)
                 {
                 return getMessage("EditGoose");
                 }
                 else
                 {
                 return getMessage("NewGoose");
                 }
                 }
                
                 public String getRowCount()
                 {
                 return getMessage("TotalRowsFound") + ": " + gaasPaginationService.getRowCount();
                 }
                
                 public String search()
                 {
                 selectedTab = "tabGaasAll";
                 gaasPaginationService.getSearchBean().setGaas(true);
                 gaasPaginationService.initSorting();
                 return null;
                 }
                
                 public void setSearchBean(SearchBean searchBean)
                 {
                 gaasPaginationService.setSearchBean(searchBean);
                 }
                
                 public SearchBean getSearchBean()
                 {
                 return gaasPaginationService.getSearchBean();
                 }
                
                 public void setGaasPaginationService(GaasPaginationService gaasPaginationService)
                 {
                 this.gaasPaginationService = gaasPaginationService;
                 }
                
                 public void setGaasService(GaasService gaasService)
                 {
                 this.gaasService = gaasService;
                 }
                
                 public boolean isTabNewDisabled()
                 {
                 return tabNewDisabled;
                 }
                
                 public void setTabNewDisabled(boolean tabNewDisabled)
                 {
                 this.tabNewDisabled = tabNewDisabled;
                 }
                
                 public boolean isTabAllDisabled()
                 {
                 return tabAllDisabled;
                 }
                
                 public void setTabAllDisabled(boolean tabAllDisabled)
                 {
                 this.tabAllDisabled = tabAllDisabled;
                 }
                
                 public Gaas getChosenGaas()
                 {
                 return chosenGaas;
                 }
                
                 public void setChosenGaas(Gaas chosenGaas)
                 {
                 this.chosenGaas = chosenGaas;
                 }
                
                 public HtmlDataTable getDataTable()
                 {
                 return dataTable;
                 }
                
                 public void setDataTable(HtmlDataTable dataTable)
                 {
                 this.dataTable = dataTable;
                 }
                
                 public HtmlDatascroller getDatascroller()
                 {
                 return datascroller;
                 }
                
                 public void setDatascroller(HtmlDatascroller datascroller)
                 {
                 this.datascroller = datascroller;
                 }
                
                 public Integer getScrollerPage()
                 {
                 return scrollerPage;
                 }
                
                 public void setScrollerPage(Integer scrollerPage)
                 {
                 this.scrollerPage = scrollerPage;
                 }
                
                 public String getSelectedTab()
                 {
                 return selectedTab;
                 }
                
                 public void setSelectedTab(String selectedTab)
                 {
                 this.selectedTab = selectedTab;
                 }
                
                 public boolean isTabSearchDisabled()
                 {
                 return tabSearchDisabled;
                 }
                }
                


                faces config..:

                <?xml version='1.0' encoding='UTF-8'?>
                <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
                 version="1.2">
                
                 <managed-bean>
                 <managed-bean-name>mainMenu</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.MainMenu</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>messages</property-name>
                 <value>#{messages}</value>
                 </managed-property>
                 <!--<managed-property>
                 <property-name>usersBean</property-name>
                 <value>#{adminUsersBean}</value>
                 </managed-property>-->
                 <managed-property>
                 <property-name>sessionBean</property-name>
                 <value>#{sessionBean}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>gaasBean</property-name>
                 <value>#{gaasBean}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>observMarkedBean</property-name>
                 <value>#{observMarkedBean}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>observBean</property-name>
                 <value>#{observBean}</value>
                 </managed-property>
                 </managed-bean>
                
                 <!--<managed-bean>
                 <managed-bean-name>adminUsersBean</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.admin.UsersBean</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>messages</property-name>
                 <value>#{messages}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>userService</property-name>
                 <value>#{userService}</value>
                 </managed-property>
                 </managed-bean>-->
                
                 <managed-bean>
                 <managed-bean-name>gaasBean</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.GaasBean</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>messages</property-name>
                 <value>#{messages}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>gaasPaginationService</property-name>
                 <value>#{gaasPaginationService}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>gaasService</property-name>
                 <value>#{gaasService}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>miscBean</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.MiscBean</managed-bean-class>
                 <managed-bean-scope>request</managed-bean-scope>
                 <managed-property>
                 <property-name>miscService</property-name>
                 <value>#{miscService}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>observBean</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.ObservBean</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>messages</property-name>
                 <value>#{messages}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>observPaginationService</property-name>
                 <value>#{observPaginationService}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>observationService</property-name>
                 <value>#{observationService}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>appConstants</property-name>
                 <value>#{appConstants}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>observMarkedBean</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.ObservMarkedBean</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>messages</property-name>
                 <value>#{messages}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>observMarkedPaginationService</property-name>
                 <value>#{observMarkedPaginationService}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>observationService</property-name>
                 <value>#{observationService}</value>
                 </managed-property>
                 <managed-property>
                 <property-name>appConstants</property-name>
                 <value>#{appConstants}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>gaasPaginationService</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.services.GaasPaginationService</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>gaasService</property-name>
                 <value>#{gaasService}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>observPaginationService</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.services.ObservPaginationService</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>observationService</property-name>
                 <value>#{observationService}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>observMarkedPaginationService</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.services.ObservMarkedPaginationService</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>observationService</property-name>
                 <value>#{observationService}</value>
                 </managed-property>
                 </managed-bean>
                
                 <managed-bean>
                 <managed-bean-name>sessionBean</managed-bean-name>
                 <managed-bean-class>no.havleik.gaas.jsf.SessionContainer</managed-bean-class>
                 <managed-bean-scope>session</managed-bean-scope>
                 <managed-property>
                 <property-name>messages</property-name>
                 <value>#{messages}</value>
                 </managed-property>
                 </managed-bean>
                
                 <navigation-rule>
                 <from-view-id>*</from-view-id>
                
                 <!--<navigation-case>
                 <from-outcome>menu_adminusers</from-outcome>
                 <to-view-id>/secure/admin/users.xhtml</to-view-id>
                 </navigation-case>-->
                
                 <navigation-case>
                 <from-outcome>menu_geeseshowall</from-outcome>
                 <to-view-id>/secure/gaas/gaas.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_goosenew</from-outcome>
                 <to-view-id>/secure/gaas/gaas.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_obsmarkedshowall</from-outcome>
                 <to-view-id>/secure/observ/observmarked.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_obsmarkednew</from-outcome>
                 <to-view-id>/secure/observ/observmarked.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_obsunmarkedshowall</from-outcome>
                 <to-view-id>/secure/observ/observunmarked.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_obsunmarkednew</from-outcome>
                 <to-view-id>/secure/observ/observunmarked.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_mainpage</from-outcome>
                 <to-view-id>/secure/main.xhtml</to-view-id>
                 </navigation-case>
                
                 <navigation-case>
                 <from-outcome>menu_logout</from-outcome>
                 <to-view-id>/secure/main.xhtml</to-view-id>
                 <redirect/>
                 </navigation-case>
                
                 </navigation-rule>
                
                 <converter>
                 <converter-id>no.havleik.Number</converter-id>
                 <converter-class>no.havleik.gaas.jsf.converters.NumberConverter</converter-class>
                 </converter>
                
                 <converter>
                 <converter-id>no.havleik.Double</converter-id>
                 <converter-class>no.havleik.gaas.jsf.converters.DoubleConverter</converter-class>
                 </converter>
                
                 <validator>
                 <validator-id>no.havleik.Fotring</validator-id>
                 <validator-class>no.havleik.gaas.jsf.validators.ValidateFotring</validator-class>
                 </validator>
                
                 <validator>
                 <validator-id>no.havleik.Halsring</validator-id>
                 <validator-class>no.havleik.gaas.jsf.validators.ValidateHalsring</validator-class>
                 </validator>
                
                 <application>
                 <el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
                 <resource-bundle>
                 <base-name>Gaas</base-name>
                 <var>msgs</var>
                 </resource-bundle>
                 <locale-config>
                 <default-locale>no</default-locale>
                 <supported-locale>no</supported-locale>
                 <supported-locale>en</supported-locale>
                 </locale-config>
                 </application>
                
                </faces-config>
                



                Do you see anything wrong? ;)


                BTJ


                • 5. Re: Strange input problem using ajax?
                  bjorntj

                  Hmmm... I managed to post the wrong code.. :(

                  But I also found the problem.... :)
                  The reasong for this, was that the field was marked as required and hence could not update itself when cleared.... :-|


                  BTJ