3 Replies Latest reply on Sep 28, 2007 6:38 AM by alexanderbelov

    How to display validation error on ajax event

    lmk

      Hello,

      Id like to display jsf validation error on after ajax event.
      I have a required input text, if I try to send an ajax request before entering the text field, validation error occured, but <h:messages /> do not display anything.
      it's a bit improper for the user ..
      should i customize <rich:messages/> or there exist another solution?

      thanks.

        • 1. Re: How to display validation error on ajax event

          you can use

          <rich:messages /
          >
          or use:
          <a4j:outputPanel ajaxRendered="true">
           <h:messages />
          </a4j:outputPanel>


          P.S. I cannot realize why it was a surprise for you. In RichFaces, only the areas you explicitly point to are re-rendered. You did not point to h:message. Why you expected to see it showed?

          • 2. Re: How to display validation error on ajax event
            lmk

            It was not a surprise for me. I look for a judicious solution to get users an explicit message.
            I tried reRender the <h:messages/>, the error message was not printed.

            <a4j:outputPanel ajaxRendered="true">
             <h:messages />
            </a4j:outputPanel>
            


            this works fien..

            thanks a lot..


            • 3. Re: How to display validation error on ajax event

              If you want to reRender component by AJAX, you shouldn't set it's id. You should update parent component, for example h:panelGroup or a4j:outputPanel.
              Ajax4JSF doen't rerender component, it updates content of the component. You can read about it in Developer Guide.