Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Dynamically enabling/disabling radio button

Reply
Thread Tools

Dynamically enabling/disabling radio button

 
 
dougawells@gmail.com
Guest
Posts: n/a
 
      03-30-2006
Hi-
I'm wanting to have a set of radio buttons disabled when a form is
displayed, then if they check another specific radio button, those
would become enabled. I've tried setting it via
window.document.formname.radiogroup.disabled="true "; (or false) - but
that doesn't seem to work. I've seen this done with text boxes, but not
with radio buttons. Can anyone give any help?

Thanks

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      03-30-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> I'm wanting to have a set of radio buttons disabled when a form is
> displayed, then if they check another specific radio button, those
> would become enabled. I've tried setting it via
> window.document.formname.radiogroup.disabled="true "; (or false) - but
> that doesn't seem to work.


Elements with the same name, especially all radio buttons of a button
group, create a HTMLCollection object in the DOM. The property value
is of type `boolean', not of type `string'.

<URL:http://www.w3.org/DOM-Level-2-HTML/html.html#ID-50886781>

It should be something like this:

var rbs = window.document.forms['formname'].elements['radiogroup'];
for (var i = rbs.length; i--
{
rbs[i].disabled = true; // or false
}

Consider disabling a `fieldset' element that contains the radio button
group, instead (untested), and be sure to do feature tests on runtime.

<URL:http://jibbering.com/faq/#FAQ4_13>
<URL:http://pointedears.de/scripts/test/whatami>


PointedEars
 
Reply With Quote
 
 
 
 
dougawells@gmail.com
Guest
Posts: n/a
 
      03-30-2006
Thanks much - that did it. I think the issue was that I didn't realize
that it was boolean.
Doug

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Align Radio Button text and button tshad ASP .Net 6 11-26-2009 08:52 AM
ASP.NET Reset Radio Button in a group of Radio Buttons Scott D Johnson ASP .Net 1 09-27-2006 10:38 PM
Get values of dynamically created radio button control Karthick Kumar ASP .Net 1 11-05-2004 06:08 PM
Get values of dynamically created radio button control Karthick Kumar ASP .Net Web Controls 0 11-05-2004 11:06 AM
Radio button List problem: How to find value of Radio button list's Selected Item using javascript?? Hiten ASP .Net Web Controls 1 05-26-2004 10:32 AM



Advertisments