Thank you very much. Your code was exactly what I needed. With your help 
the complete working example becomes this: http://tinyurl.com/qxvp8vo



On 24/08/2015 06:56 πμ, John Spackman wrote:
> For your first example you have implemented validateUsername as an 
> asynchronous function but asynchronous validations need to be implemented via 
> qx.ui.form.AsyncValidator.  To handle the asynchronous exception, you need to 
> catch it in an AsyncValidator’s callback.   You’re already doing this for the 
> server based test, so perhaps you should merge your two async tests into one, 
> or make validateUsername synchronous (EG because it only runs on the client).
>
> In your second example, you’re getting “you can send” then “nope” because 
> your Async validator calls setValid(true) and then later on setValid(false), 
> so you get two “complete" events.  Also, as with your first example, your 
> validateUsername() needs to either not throw any exceptions (because it is 
> asynchronous) or needs to be called synchronously.
>
> Try this: http://tinyurl.com/ou2cml2
>
>
>
> On 23/08/2015 23:08, "voger" <[email protected]> wrote:
>
>> I have this example http://tinyurl.com/nay2rnr
>> I am trying to validate asynchronously the username. So on changeValue
>> of that field I call a function that asynchronously validates the
>> username and if it is invalid it throws an error. Unfortunately since
>> the call is asynchronous, when the function returns the caller has long
>> ended so there is no one to catch the exception. How can I handle the
>> exception?
>>
>> I know I can handle the valid state of the item right there in the async
>> function but I want to know what is the proper way to handle
>> asynchronously the exception.
>>
>> Also how can I use that function in a DRY way? The closer I came up is
>> this http://tinyurl.com/o2r56zv but when I press send, even if the field
>> is invalid I get "You can send" first and later I get "Nope..."
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>


------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to