SmellyKat
07-04-2005, 01:26 PM
Hello,
This is my first post on this site. I have spent the last few hours going through the JavaScript postings looking for the problem that I am having. Some were close and I tried to emulate them with not much success.
I am writing a form that needs to have a drop down box when selected and will unhide/hide two different dropdown boxes (depending on what is selected). if the user selects Closed then a drop down box will appear giving a the user a selection of who closed it. If the user selects Re-Assign from the first drop down box then a different drop down box will appear.
The problems I am having are as follows:
1) I have no idea what I am doing. I code normally in C# and JAVA I do not like HTML or JavaScript much but here I am stuck with this project. The form is initially done in PHP so bear with coding. ( When I do get a working model I do plan on refactoring)
2) Hiding the drop down boxes
a) it took a while but I finally got them hidden (I think) they do not show up on the webpage.
3) I cannot seem to get the the JavaScript correct to toggle the drop down boxes from hidden to visible.
a) I want this done on the fly if possible.
4) the page is quite lengthy so I wont waste your time showing the entire page just the form name, JavaScript, and Drop down boxes.
5) The page runs however when I select either closed by or Re-Assign I get the following error
OBJECT DOES NOT SUPPORT THIS ACTION
I am sure I am going to hit my head on the wall(or desk) when the answer is shown to me, but I am stuck and your website seems friendly and easy to understand unlike others that I have posted to.
Thank you in advance if you can help me.
If you need to see the entire page I can do that as well.
function selection()
{
if (document.close.status4.selectedIndex == 'Closed')
{
document.all.sel1.style.visiblity = "visible";
document.all.sel2.style.visiblity = "hidden";
}
else if (document.close.status4.selectedIndex == 'Re-Assign')
{
document.all.sel2.style.visiblity = "visible";
document.all.sel1.style.visiblity = "hidden";
}
else
{
document.all.sel1.style.visiblity = "hidden";
document.all.sel2.style.visiblity = "hidden";
}
<form name="close" method="POST" action="update.php" onSubmit="return Validate()">
<tr>
<td align="right"><strong>Change Status To:</strong></td>
<td align="left">
<select name="status4" style="WIDTH: 125px" onChange="selection()">
<option value="" selected=""></option>
<option value="Closed">Closed</option>
<option value="Re-Assign">Re-Assign</option>
</select></td>
</tr>
<?php
//Closed by
echo "<div id=\"sel1\" STYLE=\"position:absolute; visibility:hidden;\">";
echo "<table>";
include("sql_logon.inc");
echo "<td align=\"right\"><strong>Closed By:</strong></td>";
$query2 = "SELECT user FROM users ORDER BY user_id";
$result2 = mysql_query($query2);
echo "<td><select name=\"closed_by4\" style=\"WIDTH: 125px\">";
echo "<option value=\"\" selected=\"\"></option>";
while($row = mysql_fetch_array($result2))
{
$user = $row['user'];
echo "<OPTION value=\"$user\">$user</option>";
}
echo "</select></td></div>";
//Re-Assigned to
echo "<div id=\"sel2\" STYLE=\"position:absolute; visibility:hidden;\">";
include("sql_logon.inc");
echo "<td align=\"right\"><strong>Re-assigned to:</strong></td>";
$query2 = "SELECT user FROM users ORDER BY user_id";
$result2 = mysql_query($query2);
echo "<td><select name=\"reassigned_to4\" style=\"WIDTH: 125px\">";
echo "<option value=\"\" selected=\"\"></option>";
while($row = mysql_fetch_array($result2))
{
$user = $row['user'];
echo "<OPTION value=\"$user\">$user</option>";
}
echo "</select></td></tr></table></div>";
?>
This is my first post on this site. I have spent the last few hours going through the JavaScript postings looking for the problem that I am having. Some were close and I tried to emulate them with not much success.
I am writing a form that needs to have a drop down box when selected and will unhide/hide two different dropdown boxes (depending on what is selected). if the user selects Closed then a drop down box will appear giving a the user a selection of who closed it. If the user selects Re-Assign from the first drop down box then a different drop down box will appear.
The problems I am having are as follows:
1) I have no idea what I am doing. I code normally in C# and JAVA I do not like HTML or JavaScript much but here I am stuck with this project. The form is initially done in PHP so bear with coding. ( When I do get a working model I do plan on refactoring)
2) Hiding the drop down boxes
a) it took a while but I finally got them hidden (I think) they do not show up on the webpage.
3) I cannot seem to get the the JavaScript correct to toggle the drop down boxes from hidden to visible.
a) I want this done on the fly if possible.
4) the page is quite lengthy so I wont waste your time showing the entire page just the form name, JavaScript, and Drop down boxes.
5) The page runs however when I select either closed by or Re-Assign I get the following error
OBJECT DOES NOT SUPPORT THIS ACTION
I am sure I am going to hit my head on the wall(or desk) when the answer is shown to me, but I am stuck and your website seems friendly and easy to understand unlike others that I have posted to.
Thank you in advance if you can help me.
If you need to see the entire page I can do that as well.
function selection()
{
if (document.close.status4.selectedIndex == 'Closed')
{
document.all.sel1.style.visiblity = "visible";
document.all.sel2.style.visiblity = "hidden";
}
else if (document.close.status4.selectedIndex == 'Re-Assign')
{
document.all.sel2.style.visiblity = "visible";
document.all.sel1.style.visiblity = "hidden";
}
else
{
document.all.sel1.style.visiblity = "hidden";
document.all.sel2.style.visiblity = "hidden";
}
<form name="close" method="POST" action="update.php" onSubmit="return Validate()">
<tr>
<td align="right"><strong>Change Status To:</strong></td>
<td align="left">
<select name="status4" style="WIDTH: 125px" onChange="selection()">
<option value="" selected=""></option>
<option value="Closed">Closed</option>
<option value="Re-Assign">Re-Assign</option>
</select></td>
</tr>
<?php
//Closed by
echo "<div id=\"sel1\" STYLE=\"position:absolute; visibility:hidden;\">";
echo "<table>";
include("sql_logon.inc");
echo "<td align=\"right\"><strong>Closed By:</strong></td>";
$query2 = "SELECT user FROM users ORDER BY user_id";
$result2 = mysql_query($query2);
echo "<td><select name=\"closed_by4\" style=\"WIDTH: 125px\">";
echo "<option value=\"\" selected=\"\"></option>";
while($row = mysql_fetch_array($result2))
{
$user = $row['user'];
echo "<OPTION value=\"$user\">$user</option>";
}
echo "</select></td></div>";
//Re-Assigned to
echo "<div id=\"sel2\" STYLE=\"position:absolute; visibility:hidden;\">";
include("sql_logon.inc");
echo "<td align=\"right\"><strong>Re-assigned to:</strong></td>";
$query2 = "SELECT user FROM users ORDER BY user_id";
$result2 = mysql_query($query2);
echo "<td><select name=\"reassigned_to4\" style=\"WIDTH: 125px\">";
echo "<option value=\"\" selected=\"\"></option>";
while($row = mysql_fetch_array($result2))
{
$user = $row['user'];
echo "<OPTION value=\"$user\">$user</option>";
}
echo "</select></td></tr></table></div>";
?>