urgent question on disabling

Posted on 1998-12-21
Last Modified: 2013-12-25
hi, I want to have two combo boxes with radio buttons attached with them. So that when I click radio 1, I can pick the list from the combo1, when I click radio 2, I can pick the list from the combo2. I can't pick combo1 and combo2 at the same time.
Could anyone send me some sample code?
I will appreicate your help!

Question by:mklee
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
  • 4
  • 4

Expert Comment

ID: 1857418
You can't do this in HTML - you will need to use JAVASCRIPT.

Then, use the onClick=xxxx in the <input type=xxxx to invoke a function that checks that all you rules are observed.

Expert Comment

ID: 1857419
What do you mean by picking up from the list? i.e. handling it in any script(CGI or ASP)? If so, which type of scripting you're using?

Author Comment

ID: 1857420
I understand the concept that you answer, but I have no clue how to start? Could anyone give me some simple sample code?
I am using ASP, in this case, after I pick one from either combobox, I will pass the variable to another ASP page and returns the records based on the criteria which i picked from the list.

Thank you

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.


Accepted Solution

rajgn earned 80 total points
ID: 1857421
Let's say you have a html/asp which has two combos(named combo1, combo2) associated with two radio buttons(named rad but values are different i.e. com1,com2). Example code is as below:

<form method="POST" action="respond.asp">
  <select name="combo1" size="1">
    <option value="-- Select One --">-- Select One --</option>
    <option value="Choice 11">Choice 11</option>
    <option value="Choice 12">Choice 12</option>
  <input type="radio" name="rad" value="com1"></p>
  <select name="combo2" size="1">
    <option value="-- Select One --">-- Select One --</option>
    <option value="Choice 21">Choice 21</option>
    <option value="Choice 22">Choice 22</option>
  <input type="radio" value="com2" name="rad"></p>
  <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset"

This will post to an asp called respond.asp

Now, include following code in respond.asp to handle the request appropriately.

if request.form("rad") = "com1" then
      response.write "select from combo1<BR>"
      response.write "Value is :" & request.form("combo1")
        ' Query the DB and return records based on Combo1, HERE
      response.write "select from combo2<BR>"
      response.write "Value is :" & request.form("combo2")
        ' Query the DB and return records based on Combo2, HERE      
end if

Author Comment

ID: 1857422
thank first.
In this case, user will still be able to select from one of the combo, am I right?
is there a way to disable either one of the combo if user clicks on another one?
That will be great!


Expert Comment

ID: 1857423
Yes, user will still be able to select from one of the combo.

No, You can't disable a combo in HTML (there is no other way unless you use java applets/activeX controls to enable/disable).

In this case even if a User selects options in other combo, it'll not do anything since you're controlling in the script.

Author Comment

ID: 1857424
Do you know how to do it in ActiveX control?
I want to know it.

If you do, I will raise 50 points for your credit.
Thank you very much


Expert Comment

ID: 1857425
May be I was not clear in my last comment (which I felt after posting it). It's impossible to enable/disable any of the forms laid down using HTML. If you want additional functionality of that kind, you've to design your own interface using either ActiveX or Java, then embed them in your page.
If you use ActiveX, you've to design/program the entire control including combos, radio buttons and their functionality using any of the Microsoft development tools (VB, VC++, VJ++ etc..) Once you go for ActiveX so many other issues will arise. It's not supported by all browsers, you need to get certificate for your control to ensure the users browsing your page that your control is safe to download. This process involves some time and effort. And most importantly maintenance in the future may become difficult(since it's developed by somebody else)

My conclusion: for the task of this magnitude I never suggest using ActiveX/Java applets. It's like getting into many other issues for accomplishing a small task in return.

Author Comment

ID: 1857426
I think your answer is very good and professional.


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to dynamically set the form action using jQuery.

696 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