Disabling a drop down box depending on a dynamically generated value

Posted on 2003-03-27
Medium Priority
Last Modified: 2010-04-01
I have a web application a JSP page that has two drop down boxes with following labels:

Box 1 : Choice 1
        Choice 2

Box 2 : Some choices

My requirement is that when i select choice 2 , my Box 2 should get disabled but if i reselect choice 1 then the Box 2 should get enabled. Box 2 should should only be enabled if Choice 1 is selected. Can some one help me out on this.

Question by:mrigank
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

thanassis earned 300 total points
ID: 8217166
you can use javascript

<script language=javascript>
function box1Change()
 if(document.form.box1.value == "choice2")
      document.form.box2.disabled = true
     document.form.box2.disabled = false
<form name="form">
 <select name="box1" onChange="box1Change()">
        <option value="none" selected>(select)</option>
        <option value="choice1">choice1</option>
        <option value="choice2">choice2</option>
  <select name="box2" onChange="">
        <option value="none" selected>(select)</option>
        <option value="about1">about1</option>
        <option value="about2">about2</option>

Author Comment

ID: 8243366
Thanks a lot Thanassis .
I got my requirement working .

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
If you're a modern-day technology professional, you may be wondering if certifications are really necessary. They are. Here's why.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question