You could always use a couple of custom validators.

Associate the first with button A to validate boxes 1 & 2 and associate the other with button B to validate boxes 3 & 4.

Bear in mind that the client-side validation isn't supported by all browsers...