</script>Note that you should use onclick, not onchange, with radio buttons. Also, note that all radio buttons in the same group have the same name (e.g. rad1), and are referred to as rad1[0], rad1[1] etc.

This form will be dynamically created, filedset by fieldset, via a PHP loop.
The fieldset ID's will also be dynamically generated.

Which would be the best way to disable all fieldsets except for the one whose radio is selected at any given time?
To me, Philip, it seems like your first suggestion would be the more appropriate option, but it's still a little over my head.

Of course, this only works if you have a one-to-one correspondence of radio buttons to fireldsets. And no unrelated fieldsets *before* the first radio button. Though it's okay to have fieldsets *after* the last one that corresponds. Or we could use class names to differentiate. Or or or.

mOrloff

08-20-2010, 10:31 PM

Awesome!
Thank you, thank you, thank you.

Old Pedant

08-20-2010, 10:36 PM

So where in the NW are you, actually? With surfboard in hand, one assume near the coast?

mOrloff

08-20-2010, 11:13 PM

I'm having some trouble getting it working, and I think I've found why.
It appears that DISABLE doesn't work on fieldsets.

I tried tweaking it a little, and even made some progress (yay!):D, but can use a little more guidance.

The goal is to have all inputs disabled except for the one which has the selected RB (if one is selected, and the selection changes, the inputs for that RB should become disabled again and the one which gets clicked should then be enabled).

Wow!
I'm able to make heads-and-tails of a lot of that, but I think a good portion is still going over my head :)

Thankfully I've got plenty of time to figure that all out, but the best part is that it works!

THANKS!

Reply to above: While I used to be much closer to the coast, I am now about 1.75 hours inland in Oregon.

Old Pedant

08-22-2010, 01:58 AM

The important part is probably this line:

var inps = fs[r].getElementsByTagName("input");

It's important to be aware the getElementsByTagName() can be applied to *ANY* "container" object, *NOT* just to the document object! So that line is saying "get me all the "input" elements that are nested inside the fs[r] element (which is of course a <fieldset>).

Without the ability to only find sub-elements using the method, doing this kind of thing would be much more tedious.