3 Replies Latest reply on Aug 13, 2007 10:49 PM by Matt Drees

    Seam + Ajax4JSF

    Phil Haigh Novice

      Hi,

      I'm using seam with a4j for dynamic validation etc etc. However, all of my a4j enabled parts of the form are actually written to the database on every change.

      E.g.

       <h:form id="webpageForm">
       <f:facet name="afterInvalidField">
       <h:panelGroup><s:message/></h:panelGroup>
       </f:facet>
       <f:facet name="aroundInvalidField">
       <s:span styleClass="error"/>
       </f:facet>
       <s:validateAll>
       <h:panelGrid columns="2" columnClasses="object, value">
      
      
       <h:outputText value="Banner #1"/>
       <h:panelGroup id="smallimage1">
       <s:decorate>
       <h:selectOneMenu value="#{webpage.banner_image_1}" required="true">
       <a4j:support event="onchange" reRender="smallimage1" ajaxSingle="true"/>
       <s:selectItems value="#{bannerImages.resultList}"
       var="image" noSelectionLabel="Please select"
       label="#{image.filename}: #{image.altText}"/>
       <s:convertEntity/>
       </h:selectOneMenu>
       </s:decorate>
       <br/>
       <h:graphicImage value="../images/#{webpage.banner_image_1.filename}" alt="#{webpage.banner_image_1.altText}"></h:graphicImage>
       </h:panelGroup>
      


      Changing the drop down will result in the database entry being updated instantly. Can someone tell me why this is the case, and what I need to do (or have missed doing) to prevent it? I want the model to be updated, naturally, but the database should only be written to when I tell it to..

      phil