Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Disabling a drop down box depending on a dynamically generated value

Posted on 2003-03-27
2
Medium Priority
?
133 Views
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.

Thanks
Mrigank
0
Comment
Question by:mrigank
2 Comments
 
LVL 4

Accepted Solution

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

<html>
<head>
<script language=javascript>
function box1Change()
{
 if(document.form.box1.value == "choice2")
      document.form.box2.disabled = true
 else
     document.form.box2.disabled = false
 }
 </script>
</head>
<body>
<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>
  <select name="box2" onChange="">
        <option value="none" selected>(select)</option>
        <option value="about1">about1</option>
        <option value="about2">about2</option>
 </select>
 </form>
</body>
</html>
0
 
LVL 5

Author Comment

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Dropbox has a relatively new feature called Smart Sync.  This feature allows Dropbox Professional (not plus) and Dropbox Business (if enabled) users to store information in Dropbox WITHOUT storing any files on their computer.
Don’ts and Dos are two important end products of software testing basics that a tester needs to regard. This article attempts to explain the principles of both.
Loops Section Overview
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

572 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