Solved

urgent question on disabling

Posted on 1998-12-21
9
196 Views
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!

mklee
0
Comment
Question by:mklee
  • 4
  • 4
9 Comments
 
LVL 8

Expert Comment

by:jhurst
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.
0
 
LVL 1

Expert Comment

by:rajgn
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?
0
 

Author Comment

by:mklee
ID: 1857420
jhurst:
I understand the concept that you answer, but I have no clue how to start? Could anyone give me some simple sample code?
rajgn:
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

0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 1

Accepted Solution

by:
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:

<html>
<head>
<title>Combossss...</title>
</head>
<body>
<form method="POST" action="respond.asp">
  <p>
  <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>
  </select>
  <input type="radio" name="rad" value="com1"></p>
  <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>
  </select>
  <input type="radio" value="com2" name="rad"></p>
  <p>&nbsp;</p>
  <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset"
  name="B2"></p>
</form>
</body>
</html>

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
else
      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
%>
0
 

Author Comment

by:mklee
ID: 1857422
rajgn:
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!


0
 
LVL 1

Expert Comment

by:rajgn
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.
0
 

Author Comment

by:mklee
ID: 1857424
rajgn:
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

mklee
0
 
LVL 1

Expert Comment

by:rajgn
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.
0
 

Author Comment

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

mklee
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ebay devID, appID, certID, userToken 2 51
CSS: How do I override in-line styling 11 24
Un-Indent Setting Notepad++ 3 18
How to control cache of some js files ? 7 38
Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

808 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