Solved

urgent question on disabling

Posted on 1998-12-21
9
191 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Accepted Solution

by:
rajgn earned 80 total points
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:mklee
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
rajgn:
I think your answer is very good and professional.

mklee
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now