Disable some ASP.Net validation controls when a checkbox is checked

后端 未结 3 569
挽巷
挽巷 2021-02-06 01:25

I\'m using old fashioned ASP.NET validation (ugh) for a checkout process. I have a checkbox -\"I\'ll call with my credit card details\"-. If checked I need to disable the requir

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-06 01:32

    You can disable the validators client-side (in javascript):

    function disable(validatorId)
    {
       var validator = document.getElementById(validatorId);
       ValidatorEnable(validator, false);
    }
    

    Where validatorId is the clientID of the validator to be disabled. See this page for a complete example.

提交回复
热议问题