1 Reply Latest reply on Jul 24, 2008 5:30 AM by anirudhs

    Custom validator

      I have created a custom validator that validates true if a entered username is not already used. If it is already used it returns a error message.

      But my problem is that the validator is one step behind.
      This mean that the when the validator is run for the first time it always returns false because the check value is initialized as false. And the webservice has not returned anything.

      How can I wait for the webservice to reply before I return the result?
        • 1. Re: Custom validator
          anirudhs Level 2

          Getting the result back from a httpservice / webservice / remoting call always happens asynchronously. That is, there is no way to force your script to wait for the result before proceeding. The validator has to return true or false immediately. There is no way to make it wait for a webservice result.

          Ideally, Flex validators are for client side validation. Though you could make a web service call, and check the result in the result handler, and then fire your validator (or simply set errorString of your component to the error message).

          Whatever the case, the validator has to have all the necessary information to validate when it is called.