PDA

View Full Version : query string


ebco
09-19-2002, 12:14 PM
i have one form with select box on which onchange i am submiting on submit i am getting the value 1%23h in my querystring it should be 1#h what i am writing is bit confusing i have mentioned my code below.


<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript">
<!--
function escapeF()
{
document.trFrm.submit();
}
//-->
</script>

</head>
<body>
<form name="trFrm">
<select name="tr" size="1" onchange="escapeF()">
<option value="select">select</option>
<script language="JavaScript" type="text/javascript">
<!--
var espChange=unescape("1%23h")
alert(espChange)
document.write('<option value="'+espChange+'">Disp value</option>');
//-->
</script>


</select>
</form>
</body>
</html>

beetle
09-19-2002, 03:25 PM
Because the # (or hash) is reserved for named anchors within a URL string. If there is a # in the value of a form element, and that form uses get, then it will be URL-encoded for proper transmission.

You should just decode it on the other end. I wrote a script (http://www.codingforums.com/showthread.php?s=&threadid=4555) that could help you with that.