I’ve been wondering about applications that have a set of checkboxes or radio buttons, even collections of form fields in their UI.
At this moment I’m handling all the choices separately but of course this becomes a complete mess very quickly. There has to be an established way to deal with this that I don’t know of.
If check box a is unchecked then check boxes d through e are enabled etc. etc.
How should I be approaching this? Not in the UI of course, that’s for sure.
I would love to hear some insights and best practices as well as potential pitfalls.
(BTW: I’ve tagged this “rules-engine” because I haven’t got a clue what to tag this. Please feel free to edit the question, retag and remove this line.)
I built an e-commerce site with a complicated set of product configurations. When the user went to the individual product’s configuration page, it needed to load the available options, enable/disable controls based on the choices made, and update price on-the-fly.
The data model stored all of the possible options for every product. I wrote a ConfigurationEngine class which contained the logic for all of the allowed combinations (many simple cases were stored in the DB, others had to be coded). When the user made any change on the product configuration page I made an AJAX call. The server would put together the product object with its selected configuration and pass it through the ConfigurationEngine. The product came out validated and priced. Another function on the engine would tell us which remaining options were still available. The product price, validation messages, and remaining available options were then passed back to the front-end in response to the AJAX call.