Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » drop down selection shows/hides divs
Closed Thread
Old 01-17-2006, 03:39 PM   #1 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,425

office politics will become famous soon enough

Default drop down selection shows/hides divs

i have one drop down listed first with report names. Below this drop down i have two textbox inputs and a asp generated drop down list. Each report should have its own definition for which inputs to show. I dont care what the other inputs are cus i wont be using them.

I having problems trying to have the script recognize whats selected in the report drop down (description). the window alert displays undefined when i pick form the list.

Code:
<script>
function select()
{

window.alert(document.values.description.selectedindex);

if (document.values.description.selectedindex == 0)
{
document.getElementById(start).style.visibility = "visible";
document.getElementById(end).style.visibility = "visible";
document.getElementById(userid).style.visibility = "visible";
}
else if (document.values.description.selectedindex == 1)
{
document.getElementById(start).style.visibility = "visible";
document.getElementById(end).style.visibility = "visible";
document.getElementById(userid).style.visibility = "hidden";
}
else
{
document.getElementById(start).style.visibility = "hidden";
document.getElementById(end).style.visibility = "hidden";
document.getElementById(userid).style.visibility = "hidden";
}
}</script>

<body OnLoad="document.values.start.focus();">
<form name=values action=" <%= request.servervariables("URL") %>" action="post">
<div id="report" STYLE="visibility:visible;">
<select name=description onchange="select();">
<option>Faxes Sent</option>
<option>Alissa</option>
</select></div>
<table><tbody>
<div id="start" STYLE="visibility:hidden;"><tr>
  <td>Start Date</td>
  <td><input type="text" name=start value=<%= request.form("start") %>></td>
  <td>YYYYMMDD</td>
</tr></div>
<div id="end" STYLE="visibility:hidden;"><tr>
  <td>End Date</td>
  <td><input type="text" name=end value=<%= request.form("end") %>></td>
  <td>YYYYMMDD</td>
</tr></div>
<div id="userid" STYLE="visibility:hidden;">
<tr>
  <td>Userid</td>
  <td><% query = "select loginname from irsysusers where isgroup = 0 and status = 12 order by loginname"
         srs.open query, sconn
         if srs.eof then 
           response.write "NO USERS FOUND IN DATABASE, CONTACT SYSTEMS DEPT"
         else 
           response.write "<select name=user>"
           do until srs.eof 
             response.write "<option>" & srs.fields("loginname") & "</option>" 
             srs.movenext 
           loop
           response.write "</select>" 
         end if %>
</tr></div>
</tbody></table>

<input type=hidden name=action value=exe>
<input type=submit value="Create Report"></form>

office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On