Form Anchoring.
Posted: Fri Sep 23, 2005 12:20 pm
Hi, I've a forms with some inputs and one of the inputs is a Drop Down List. What happen is I have to scroll the form down to select from to the Drop Down List and make a selection. When I did this, my form jump back to top like when I first entered the page. I've used anchoring like below but it doesn't look like it's working. Could someone takes a look a the script and let me know what I did wrong. Thanks
Code: Select all
<?php
include "online.php";
?>
<SCRIPT LANGUAGE=javascript>
function selDept(obj)
{
document.getElementById("hidDept").value=obj.options[obj.options.selectedIndex].value
if(document.getElementById("hidDept").value!="")
{
document.getElementById ("frmDept").submit()
}
}
</SCRIPT>
<form name="frmDept" id="frmDept" method="post" action="http://MyForm.com/NewTicket">
<input type="hidden" name="hidDept" id="hidDept" value="<? echo $tmpDept; ?>">
</form>
<form name="frmTicket" method="post" enctype="multipart/form-data">
<table width="650" border="0" align="center" cellpadding="1" cellspacing="1">
<tr align="left" valign="top">
<td colspan="2">
<table width="650" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><strong>Submit a support ticket<br>
</strong><img src="images/submitticket.png" width="54" height="54"></td>
<td width="45" align="center" valign="top"><a href="index.php?x=home"><img src="images/back.png" width="54" height="54" border="0"><br>
Back</a></td>
</tr>
</table>
</td>
</tr>
<tr align="left" valign="center">
<td> </td>
<td> </td>
</tr>
<tr align="left" valign="center">
<td ><font color="#<? echo $fontname ?>">User Name</font></td>
<td width="450">
<input name="name" type="text" id="name" value="<?php if(isset($_SESSION["name"])){ echo $_SESSION["name"]; } ?>" disabled maxlength="50">
</td>
</tr>
<tr align="left" valign="center">
<td width="130"><font color="#<? echo $fontemail ?>">E-mail</font></td>
<td> <input name="email" type="text" id="email" value="<?php if(isset($_SESSION["email"])){ echo $_SESSION["email"]; } ?>" maxlength="50"></td>
</tr>
<tr align="left" valign="center">
<td width="130"><font color="#<? echo $fontsubject ?>">Subject</font></td>
<td><input name="subject" type="text" size="60" id="subject" value="<?php if(isset($_SESSION["subject"])){ echo $_SESSION["subject"]; } ?>" maxlength="120"></td>
</tr>
<a name='$Counter'></a>
<tr align="left" valign="center">
<td><br><font color="#<? echo $fontdep ?>">Department</font></td>
<td><br>
<select name="department" id="department" onchange="javascript:selDept(this)">
<!-- <select name="department" id="department" onchange="javascript:putValue()"> -->
<?php