Multiple fields validation using Remote Validation

前端 未结 4 1176
礼貌的吻别
礼貌的吻别 2020-11-29 03:26

I have the following model:

public class Customer
{
    public string FirstName {get;set;}

    public string LastName {get; set;}

    [Remote(\"CardExistin         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-29 04:20

    The way I have got this working is by adding some JavaScript.

    $("#FirstName").change(function () {
      $('#CardNumber').removeData('previousValue');
      $('#CardNumber').valid();
    });
    

    So when the first name is changed you clear any previous values from the card number and re-validate the card number.

提交回复
热议问题