With JQuery Validation Plugin, I want to change the remote validation method

前端 未结 3 1345
醉酒成梦
醉酒成梦 2020-12-19 20:18

I\'m using jquery validate plugin to validate an email address against a database using the remote method of this plugin.

I need to check the email address is not i

3条回答
  •  伪装坚强ぢ
    2020-12-19 20:53

    From what I can tell, this may be a limitation of the validate plugin. There are several options for triggering the validation (which is what you want to do) given at http://docs.jquery.com/Plugins/Validation/validate#toptions but I don't see a way to trigger validation on one element when another element changes.

    Your best bet is to place your validation code in something like this:

    $('select#siteid').onChange(function(){
            $('form.validatedform').validate({ 
                     rules:{
                           email: {
                                  required: true,
                                  email: true,
                                  remote: 'emailcheck2.asp?siteid=' + $('#siteid').val()
                           }
                      }
             });
      });
    

提交回复
热议问题