7 Replies Latest reply on Oct 16, 2010 8:08 AM by mpevec

    Seam field validation with no model update

    pmurphy.pjmurphy.paddypower.com

      Hi,


      The behaviour I would like to see is as follows:


      1) User edits a field (pre-populated with data from entity).

      2) Field validation occurs when user tabs out of field, however the model should not be updated.

      3) If user changes data to some other valid entry when leaving the field it should hold this value in the field but not update the model.

      4) User presses command button to commit the changes.


      The problem I am facing is that after step 3 (on leaving the field) the field reverts back to the original value and the user's change it lost.


      Here is a snippet of the xhtml I am using:-


      <a4j:form>
      
      <s:decorate id="startTimeDecorate" template="edit.xhtml">
        <ui:define name="label">Start Time</ui:define>
        <h:inputText id="startTime" required="true" value="#{_event.startTime}">
          <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss" timeZone="#{myAction.timeZone}" />
          <a4j:support event="onblur" reRender="startTimeDecorate"  bypassUpdates="true" ajaxSingle="true" />
        </h:inputText>
      </s:decorate>
      
      <a4j:commandButton id="updateEvent" value="Update Event" reRender="startTimeHeader" />
      
      </a4j:form>
      
      



      If someone would have a solution to this I would be very grateful.


      Thanks,


      Philip