473,232 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,232 software developers and data experts.

showing and hiding something based on selection made

I had this going yesterday, but it seems to be forgotten because it's
so far down the list now.

www.middletree.net/dropdown.htm This is from an Intranet app I have
going in ASP. I have no actual URL to show you, but this should work.

Find the <select> dropdown called Type of Ticket. Now find the one
called Environment. The boss wants a couple of things to be hidden from
the user unless both of the following two conditions are met:

1. "Problem" is selected on Type of Ticket.
2. "Production" is selected on Environment.

The part of the page that you'll want to key in on is the function
called displayRadios.

In the case of the page I am posting, please note that it's a page for
editing an existing ticket, so it happens to have Production and
Problem pre-selected. On other versions of this same page, other things
might be pre-selected.

Anyway, when this page, loads, it doesn't show the parts that I am
hoping will show. No JS error is present on load. However, when you try
and change either of the dropdowns, the JS function is fired off, and
that throws the error.

Any help appreciated.

Jul 23 '05 #1
4 2229
Not sure I fully understand, but this should be close:

I'm not sure what you want to show or hide from the user. I'll assume it's
in a <div id="secretstuff"> or <span id="secretstuff">

something like this maybe?

<html>
<head>
<title>Show/Hide Demo</title>
<script type="text/javascript">
function showhide() {
var typeofticket =
document.getElementById("typeofticket").selectedIn dex;
var environment =
document.getElementById("environment").selectedInd ex;
if (typeofticket == 1 && environment == 1) {
document.getElementById("secretstuff").style.displ ay = "inline";
} else {
document.getElementById("secretstuff").style.displ ay = "none";
}
}
</script>
</head>
<body>
<form>
<p><select size="1" name="typeofticket" onchange="showhide();">
<option>Choice 1</option>
<option>Problem</option>
</select><select size="1" name="environment" onchange="showhide();">
<option>Choice 1</option>
<option>Production</option>
</select></p>
</form>
<div id="secretstuff" style="display:none">Secret Stuff is here!</div>
</body>
</html>

"middletree" <mi********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I had this going yesterday, but it seems to be forgotten because it's
so far down the list now.

www.middletree.net/dropdown.htm This is from an Intranet app I have
going in ASP. I have no actual URL to show you, but this should work.

Find the <select> dropdown called Type of Ticket. Now find the one
called Environment. The boss wants a couple of things to be hidden from
the user unless both of the following two conditions are met:

1. "Problem" is selected on Type of Ticket.
2. "Production" is selected on Environment.

The part of the page that you'll want to key in on is the function
called displayRadios.

In the case of the page I am posting, please note that it's a page for
editing an existing ticket, so it happens to have Production and
Problem pre-selected. On other versions of this same page, other things
might be pre-selected.

Anyway, when this page, loads, it doesn't show the parts that I am
hoping will show. No JS error is present on load. However, when you try
and change either of the dropdowns, the JS function is fired off, and
that throws the error.

Any help appreciated.

Jul 23 '05 #2
FunGuySF wrote:
[...]
document.getElementById("secretstuff").style.displ ay = "inline";


Better to use:

...display = "";

then the default will be used (inline, block, whatever) and you don't
accidentally set it to the wrong one.

Please don't top-post and remove any unnecessary quoted text from the
reply (see the group FAQ at:

<URL:http://www.jibbering.com/faq/>

--
Rob
Jul 23 '05 #3
> RobG wrote:
[...]
Please don't top-post and remove any unnecessary quoted text from the
reply


My apologies :)

Mike
Jul 23 '05 #4
Thanks for your help. I have it now.
And for the record, I am pro-top-posting.

Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: c.anandkumar | last post by:
Hi All - I have some problems getting a small piece of javascript working correctly for Firefox. Here is what I am trying to do - 1. I have a form (like a search form) 2. I have many groups...
1
by: Jacky11 | last post by:
Can anyone help me? Please see the code I'm using now. Public Function sheetlayout() On Error GoTo Err_Command1_Click Dim xl As Object Set xl = GetObject("c:\windows\desktop\123.csv")...
1
by: Darsin | last post by:
What i am doing is to pull the data from a CMS and import it to Word 2007 Beta and i also have to export the data from Word 2007 Beta back to that CMS. We have with us two Web Services of the CMS....
1
by: Grimm | last post by:
I am developing an internalk inteface that integrates alot of seperate tools into one interface. The current version uses one Iframe inside a div layer for positioning. Currently the seperate web...
5
by: jonosborne | last post by:
Hi, i have managed to filter a report based on selections made in a list box but am totally confused with a message box that appears everytime i run my report. Let me explain (i apologise for...
17
by: rohitchawla | last post by:
i am trying to show and hide a div when onmouseover and onmouseover another div element. i am setting a setTimeout duration on onmouseout to delay the hiding of div for around two second The...
162
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you...
9
by: Brett_A | last post by:
I have a form where the first field is a dynamic drop-down that pulls from a db (Access). The fields associated with the query are task_id, task_name and task_rate. The field has the value of...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.