Custom validator against remote object

I need to check the field against our database in order to verify uniqueness. The problem that I seem to run into is that the doValidation () validators terminate before we hear from the database.

How can I make the validator wait for its payload until we find out from the database?

Or maybe the best question may be (since I think the first question is impossible), how can I set it differently so that I don't have to wait, or so that waiting does not cause a check to automatically return a valid one?

+3
source share
3 answers

What I managed to do seems to work, basically. I do not like this, but at least it checks against a remote source.

What I did was use the keyUp event handler to unscrew the database search part. Meanwhile, I created a string variable to act as some kind of flag that will be marked as "processing". When the response event fires, I will examine its contents and either clear the flag or set it to some other error.

Then I created a new "EmptyStringValidator", check the contents of this flag and do its work accordingly.

His indirect, but, apparently, work.

0
source

, . , -, .

( ), . :

<s:RemoteObject id="employeeService"
  destination="ColdFusion"
  source="f4iaw100.remoteData.employeeData"
  endpoint="http://adobetes.com/flex2gateway/"
  result="employeeService_resultHandler(event)"/>
    **<s:method name="dataCheckCall" result="dataCheckResult(event)"/>**
<s:RemoteObject />

script:

function protected dataCheckResult(event:ResultEvent):void {
  **doValidate();**
}

: "dataCheckCall", . - WITHIN , , dataCheckResult , (pretend doValidate ). .

+1

You are trying to install an asynchronous process (extracting data from the database) into a synchronous process (checking all validators in turn).

This will not work ...

You need to either roll up your own validator system or use another method to determine the legitimacy of your controls.

PS MX validators are still trash!

0
source

Source: https://habr.com/ru/post/1770558/


All Articles