Implementing remote methods isn't as simple as that. Your method
returns undefined on the first call, and further calls will return the
result of the previous validation.

Use the remote method instead:
http://docs.jquery.com/Plugins/Validation/Methods/remote

Jörn

On Wed, May 20, 2009 at 11:08 AM, viralme <viral00...@gmail.com> wrote:
>
> $(document).ready(function() {
>    var valprod = $("#frmProduct").validate({
>        onkeyup:false,
>        rules: {
>            txtProduct:{
>                required: true,
>                minlength: 4,
>                productCheck: true
>            }
>        }
>    });
>
>    valprod.resetForm();
> });
>
> jQuery.validator.addMethod('productCheck', function(productname) {
>
>    var postURL = "product/confirm_prod";
>
>    $.ajax({
>        cache:false,
>        async:false,
>        type: "POST",
>        data: "txtProduct=" + productname,
>        url: postURL,
>        success: function(msg) {
>            result = (msg=='TRUE') ? true : false;
>        },
>    });
>    return result;
>    }, 'Record Found'
> );
>
> my only issue is whenever 1st time it checks the record if found
> record it display message Record Found but whenever i try to change my
> textbox value it still gives me this message. it does not get reset if
> record not found.
>
>
>

Reply via email to