0 Replies Latest reply on Jul 28, 2010 7:33 AM by christophe delarue

    How to validate an inputText on each keyup

    christophe delarue Newbie


      I have a inputText that I'd like to be validated each time the content is modified.
      Thus I have wrote :

      <s:decorate id="XpathDecorate" template="layout/edit.xhtml">
        <ui:define name="label">#{messages.xpathLabel}</ui:define>
        <h:inputText id="xpath" required="true" size="70"
          <a:support event="onkeyup" reRender="XpathDecorate" bypassUpdates="true"/>

      Once a new character is entered in the inputText, I request to rerendre the Decoration to display the error if the xpath expression is wrong, which is validated by a @Validator java class.

      The problem is that the focus is lost on each event. This is surely due to the fact that I rerender the s:decorate, thus the inputText is rebuilt, and the focus is lost.

      I cannot redisplay just the error message, since there is no id possible in the layout/edit.xhtml (standard seam-gen) file.

      Is it possible with the s:decorate and a:support tags ?