I’ve read about how to get validation of my MVC Model working. It’s pretty cool.
But I need to validate a strictly UI situation, that doesn’t relate to the model. Specifically, I need to check that the user clicked one of several checkboxes before clicking a link. Let me stress, again, that the checkboxes don’t represent model data: they’re strictly for View and Controller purposes.
In the WebForms world, I’d just stick in a RequiredFieldValidator. What’s the equivalent for a field that DOESN’T represent a field on a model?
You will need to do some custom model binding to check the request object and act accordingly (adding modelstate errors, etc…) Here is a post related to custom model binding that should be beneficial.
ASP.Net MVC Custom Model Binding explanation
Once in the custom model binder you can add code in the CreateModel method similar to this: