I need to validate some form inputs in complex way. E.g.
<select id="options" multiple="multiple">
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
<option>E</option>
</select>
For example, if user selects A and B, user should be given an error if user also selects D.
Note, I'm trying to keep this business rule in a separate layer from this UI code, which could be an entirely different form, e.g. checkboxes, drag-and-drop, add/delete options with possibly accompanying fields.
I'm looking for a framework, design pattern, or other elegant way to code this logic, preferably ultimately through validation attributes in a model.