开发者

MVC 3: How do I dynamically enable/disable client side validation

I have a check out view that serves as a wizard. Steps (5 of them) are contained in their own div's and are shown/hidden via jQuery as a user goes through the checkout process wizard.

On one of the steps, I have payment information. Payment options are "Pay With My Account" or "Pay with my credit card".

开发者_如何学Go

Choosing one or the other shows input controls for the chosen payment option. All this works beautifully.

Lets say I choose "Pay with my account" which then hides the credit card inputs and shows the account info inputs. This is again done through jQuery by hiding the containing div.

When I go to hit the next button, client side validation fires on the hidden credit card inputs (the containing div is hidden).

My question is, how can I use javascript/jQuery to dynamically enable/disable the validation on the hidden input controls?

Thanks in advance for any replies...


I ended up stumbling upon MVC Foolproof Validation over at CodePlex (http://foolproof.codeplex.com).

It does everything I need to and more and I didn't have to reinvent the wheel. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜