This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

dynamic disable and enable

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have 2 radio buttons and two drop downs. when selecting a radio button the select box in the same line should get enabled.Tell em a solution
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arvind,

Here is a link that might be useful, it shows how to enable and disable select box using javascript.

http://www.mredkj.com/tutorials/tutorial001.html

and this link is a great javascript resource:-
http://www.devguru.com/technologies/javascript/home.asp

Hope that helps,
Ali
 
Author
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with disabled is if it is referenced in the HTML regardless of value the element will be disabled. The solution I used is as follows:

function EnableDisable( toEnable, toDisable) {
document.getElementById( toEnable).disabled = true;
document.getElementById( toDisable).disabled = false;
}

or

function EnableDisable( toEnable, toDisable) {
document.getElementById( toEnable)[ 'disabled'] = true;
document.getElementById( toDisable)[ 'disabled'] = false;
}

Either one is ok.
 
Liyaquat Ali
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes that sound like a very good solution, heck it is the entire solution.

Gr8 work!
 
reply
    Bookmark Topic Watch Topic
  • New Topic