Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using remote validation jquery plugin option only on blur event

i am using validation jQuery plugin and its remote option for check whether user enters only Persian characters in a textbox . my code and php script work fine but my problem is remote option fires whenever user type a character in textbox while i want to do that only on blur(losses focus) on the text box . this is a part of my code:

    $('#regForm').validate({
                    rules:{
                        name            :   {
                            required:true,
                            remote    : {
                                url :   'check',
                                type:   'post'
                            }
                        }
                    },
                messages:{
                    name            :   {
                        required    :   "this is Required",
                        remote      :   "Please enter Persian character "
                    }
                }
    });

what is solution?

like image 969
A.B.Developer Avatar asked Aug 15 '26 05:08

A.B.Developer


1 Answers

If you don't want your fields to validate on keyup event, then you would have to use:

$('selector').validate({
    onkeyup: false, 
    ...
});
like image 72
Shef Avatar answered Aug 16 '26 19:08

Shef