[thelist] Dumb Question (Javascript) but still causing difficulties

Tom Dell'Aringa pixelmech at yahoo.com
Tue May 11 14:55:30 CDT 2004


--- Rob Smith <rob.smith at THERMON.com> wrote:
> I'm having a slightly stubborn problem with a particular checkbox
> issue:

Bad design begets stubborn problems - sorry :) Checkboxes by design
are to be checked and unchecked. You are trying to code in behavior
that a checkbox doesn't have. Expect the unexpected.

In any event (no pun intended) what you want to do is DISABLE the
checkbox once it has been checked.

(ultra terse code example follows)
function d(cb)
{
  cb.disabled = true;
}

<input type="checkbox" name="foo" onclick="d(this)" />

Quickly tested in IE and FireFox. Should do what you want..

IF IF IF

The user doesn't have JS disabled. If they DO - they can check boxes
to the moon, no matter how you script it. So if all I want to do is
get around your little checkbox issue, I can easily do that. I would
come up with a better design. My .02.

> One last detail I might mention that must be and is by design. All
> checkboxes are named the same thing. I am going for a comma
> delimited list when the form submits. There are about 60 of these 
> checkboxes.

Then by design you have BAD design. Each checkbox should have a
unique name. Again, just my 02.

HTH

Tom

=====
http://www.Pixelmech.com/ - read my latest blog posting!
http://www.thywordistruth.net/ - Eternal Life

There is no missing link, just a fist shaken toward God.





More information about the thelist mailing list