agnikhil82
agnikhil82

Reputation: 25

How to make model field conditionally required in MVC3?

I have a view with a dropdown and a Rich Textbox. This view is associated with a model. I would like to make Rich Textbox field is required based on the value selected in dropdownlist.

is there any out of the box feature available in MVC3 to do this?

Upvotes: 1

Views: 500

Answers (1)

Slicksim
Slicksim

Reputation: 7172

I have had similar requirements in the past, I solved them using FoolProof. It provides extra validation objects such as requiredIf etc.

Only issue I have had is with the JS file, it can be a bit buggy around dates and date handling, other than that, it is ace.

Foolproof site

Upvotes: 1

Related Questions