Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Most recently selected checkbox

 
J Chung
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Greetings,

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")?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic