This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a bunch of checkboxes, and I have an alert that informs the user when he has selected the maximum number of selections. So say my maximum is six: once the user clicks on his sixth checkbox, the alert appears.
What I'm trying to do is to prevent the user from selecting a seventh checkbox unless he deselects one of the six already selected. I can retrieve all the checkbox elements as one array and access each checkbox via its index, but how can I reliably retrieve the index of the most recently selected checkbox (i.e., the index of the seventh checkbox so I can set its "checked" attribute to "false")?