How not to trigger RequiredFieldValidator on hidden field (TextBox)

前端 未结 2 982
难免孤独
难免孤独 2020-12-11 10:55

I think this is a common problem. I have a form where I show/hide fields dynamically using jQuery, depending on some radio buttons.

I have RequiredFieldValidator\'s

2条回答
  •  青春惊慌失措
    2020-12-11 11:12

    If I remember correctly there's a function called ValidatorEnable(validatorClientId, isEnabled) that allows you to disable/enable the ASP.NET validators via javascript. You could use jQuery right before your form submit to disable all your invisible validators.

    There's some documentation about client side API available from the validators here http://msdn.microsoft.com/en-us/library/aa479045.aspx

提交回复
热议问题