beebul
beebul

Reputation: 1003

Validation Attribute - checking a dynamic number of fields on a form ASP.NET MVC 2

I have a number of forms with checkboxes that need validating. For example I might have a form with 3 checkboxes and one of those 3 needs ticking and another form with 50 boxes that might need at least one item checking.

Does anyone have a ValidationAttribute that would work under these circumstances.

Many thanks for any pointers.

Upvotes: 1

Views: 266

Answers (1)

Adrian Grigore
Adrian Grigore

Reputation: 33318

You can do that with class-level validation attributes (as opposed to property-level attributes). I've written a blog article describing how to implement this on both the server and the client side if you want to make this really ajaxy... :-)

Upvotes: 1

Related Questions