I have noticed a common scenario in UI development (both Web and fat client) where there is a group of radio buttons, and clicking on a radio button means you want to "select" a certain "set" of other controls (for simplicity's sake, let's say they're all text boxes).
Just to illustrate, the asterisks represent radio buttons and the underscores represent text boxes. Each radio button should "select" the "set" of text boxes on the same line.
* ________ ________ __________
* ________
* ________ ________
So translated into UI requirements, this means
Whenever the user clicks a radio button, all the values in text boxes not in its "set" should be wiped out, and
Whenever the user starts typing into a text box, the radio button controlling it should be automatically selected (which also implies wiping out other text box values, as above).
The problem for me is that programming this correctly is surprisingly hard. There are lots of events to handle and the handlers can cause other events to fire, etc.
Is there any "pattern" for this that can be followed?