Not easy to solve - you could use $().ajaxStop() to wait for the
request to finish, then you valid() again, this time it will validate
the cached value and return the correct result.

Jörn

On Wed, May 6, 2009 at 8:00 AM, Mekilioz <mekil...@gmail.com> wrote:
>
> I'm trying to do a jquery remote validation on a 'Name' text field.
> The validation checks if the name is unique, hence it has to be done
> through the remote method.
>
> 'Save' button onclick is attached to this javascript method
>
> function validateName() {
>    txtName.rules('add', {
>        remote: {
>            url: 'validate.ashx'
>            , data: ({id: txtName.attr('name')})
>            }
>        }
>        , messages: {
>            remote: '* Error'
>        }
>    });
>    var isNameValid = txtName.valid()
>    return isNameValid;
> }
>
> The problem I have is that .valid() always returns false - because it
> doesn't wait for the remote validation GET to complete. Hence
> validation fails. Any suggestions? How do people normally do remote
> validation in jquery?
>
> Note: I know for sure that validate.ashx returns true.
>
> Thanks in advance.
>

Reply via email to