472,980 Members | 1,695 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,980 software developers and data experts.

Dynamically enabling/disabling radio button

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

Mar 30 '06 #1
2 6228
do********@gmail.com 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
Mar 30 '06 #2
Thanks much - that did it. I think the issue was that I didn't realize
that it was boolean.
Doug

Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: TheKeith | last post by:
I'm currently working on a form for my site and would like to do something that I've seen many times on other sites. I would like to make a particular form element enabled or disabled depending on...
6
by: Leonard | last post by:
I have several radio buttons for the user to choose from. I need to enable or disable a particular radio button, depending on a certain condition. How can I do this? Thanks, Leonard
2
by: adeelanjum2001 | last post by:
i am using radiolist box control in my page. when i disable radiolist box when page is displayed first time, that is not ispostback, and when i try to enable it with my javascript code afterwards,...
2
by: James P. | last post by:
Help, I need to display radio buttons on a form. The data is from SQL table: each row in each table is displayed as a radio button. I have multiple SQL tables so I understand I need to put...
7
by: John Meyer | last post by:
I have a program where I have to enable or disable a list box based upon a radio button. Is there an "enabled" property on select boxes?
0
by: krizzie khonnie | last post by:
How can I Disable a Radio Button if it's a Radio Group. Example, there's a two radio button, Value and Group, in a radio group. Now I want to disable Radio Button Value when I create a Parent Item....
1
by: hello2008 | last post by:
Hi, I have just started coding in PHP. I have coded a web page using HTML, JS, and PHP. An HTML table has to be populated dynamically using the data from the backend. Presently I have 5...
7
by: moksha | last post by:
Hi, I am new to javascript and i am facing a problem in coding. plz help me out. I am using javascript for dynamically creating a table row which contains text boxes and radio...
2
by: khizerbasith | last post by:
After disabling the radio buttons while the form is loaded i have written this code for button click but its not working any solutions........... Private Sub Button2_Click(ByVal sender As...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.