6 Replies Latest reply on Jun 5, 2007 9:34 AM by srpantano

    Is the field correct?

    srpantano

      I have an "inputext" that has a 5 character minimum for its value, so I would like a message or a picture to be displayed when the user gets it right, is this possible?

      Ps.: I'm using Hibernate Validator to verify this. Moreover, my project is a Seam project.

        • 1. Re: Is the field correct?

          so, see the main Seam example how to use validators and decorate the messages when user is wrong

          • 2. Re: Is the field correct?
            srpantano

            But I would like when it is correct? For example, the user must input a name greater than 5 characters and show the "ok" to user.

            • 3. Re: Is the field correct?

              are you speaking about ajax?

              • 4. Re: Is the field correct?
                srpantano

                Yes. Did you never see the web 2.0 sites when the information is correct a check (OK) is displayed.

                • 5. Re: Is the field correct?

                  the different between validation ok or not ok is a number of phases the jsf lifecycle passes. The INVOKE_APPLICATION phase is invoked only if validation is OK. So, you can use the action method (that will be called on the INVOKE_APPLICATION phase) to set some flag that can be used to show the "OK" button. Initiate this flag with false in the faces-config.xml and set to true in the action method.
                  Use "rendered" attribute of the button. Refer to the flag from it. This action method should be mentioned in the "action" attribute of the a4j:support attached to the input field.
                  Note that you should not point directly to the component id with reRender if this component has a "rendered" attribute. So, you need to point to the upper component ( or using a4j:outputPanel layout="none" to reserve the space for button in the browser DOM )

                  • 6. Re: Is the field correct?
                    srpantano

                    I will try this, for the moment thank you!