Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disabling dropdowns and radiobuttons 2

Status
Not open for further replies.

JavaRavyn

Programmer
May 11, 2001
6
US
Hey ya'll,

I am trying to disable some dropdown lists and radio buttons if certain values are retrieved from a table in the db. If A came back, i'd like to disable a set of radio buttons and two select boxes.

Any ideas?

thx,
M@
 
use the disable property:

Code:
document.formName.elementName.disabled = true;

or to enable:

document.formName.elementName.disabled = false;

-Greg
 
Does disabling equate to greying out the box?

I am painting a form on a jsp, and I would like to disable radiobuttons and dropdown menus based on what the user picks earlier in the form. disabled = true doesn't seem to be working.

If you can suggest anything else, I would appreciate it.
thx,
M@
 
I'm assuming that you are using javascript to validate your form?..If your form name is myForm and the thing you want to grey out is myElement it would be
Code:
if (whatever == "a") {
document.myForm.myElement.disabled = true;
}

it might not work on dropdowns..I'm not sure but I know it will work on radio buttons
 
Hey ya'll,

Thanks for all of the help. When I want to disable, I have to actually name which radiobutton I want disabled since there is more than one in the group (ie small medium or large and I want to disable small if childFlag = 'Y').

ie - document.forms[0].rbSeating[2].disabled = true ;
this disables the 3rd button in the list.

M@
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top