drop down selection shows/hides divs

Status
Not open for further replies.

office politics

It's all just 1s and 0s
Messages
6,555
Location
in the lab
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>
 
Status
Not open for further replies.
Back
Top Bottom