Click to See Complete Forum and Search --> : ACK! Focus issue;


WolfShade
03-22-2003, 03:43 PM
When a user clicks on a checkbox, the focus stays there until something else is clicked on. An onChange event doesn't happen until the focus leaves the checkbox. How can I get the focus to go somewhere else once the onChange is done?

I've tried the following:

onChange="[function]; document.form.field.focus();"
onChange="document.form.field.focus(); [function];"

I've also used just the function, with the last line of the function being "document.form.field.focus();", all to no avail.

I'm trying to count checkboxes to make sure no more than x are checked; if more than x, the last box checked becomes unckecked and removes any checked radio buttons associated with it. It works fine, except it doesn't activate until AFTER focus has left the checkbox.

Any suggestions would be greatly appreciated.

WolfShade

WolfShade
03-22-2003, 04:54 PM
I want to set it up so that if someone clicks on a radio button, the checkbox will automatically check when they do; or the radio button will uncheck of the checkbox is turned off. If the box checks itself, there will be no onClick event to trigger the function that will count the number of checkboxes that there are.

BTW.. Dave Clark.. ever taught computers at a HS in St. Louis?

WolfShade

WolfShade
03-22-2003, 05:07 PM
.. I'll give that a shot. Thanks.

RE: STL.. I had a teacher in HS that taught BASIC on TRS-80's (parochial school, little/no budget) back in the mid-1980's, who shares your monicker. Thought you might be him. (shrug)

WolfShade
03-22-2003, 05:14 PM
No.. Catholic.. St. Thomas Aquinas-Mercy. The nuns should be thankful that steel rulers weren't allowed. :)

WolfShade
03-22-2003, 05:30 PM
Well, as it turns out, STA-M is closing due to lack of attendance; ironic, since STA merged with Mercy for the same reason, back in 86 when Mercy was closed. The Arch-Diocese of STL is not putting a whole lot of money into any of its schools. Since I am not Catholic, my parental units had to pay 30% more in tuition (the AD assumes that the parents of the kids who ARE Catholic tithe on a regular basis, so shouldn't have to pay as much.)

Anyhoo. Way off topic.

I've experimented with the click(), and can't seem to get it to work; that's okay, though, because I just wrote another function that will check the checkbox when a radio button is clicked, THEN run the function to count the checked boxes. It seems to work pretty well; now I just have to copy the same onClick to every radio button and I'm done. Thanks for the suggestions.

WolfShade