BUG: JScript from ASP Page Sends Mixed-Case Boolean Values to Client (236889)
The information in this article applies to:
- Microsoft Active Server Pages
- Microsoft Internet Information Server 4.0
- Microsoft Internet Information Server 5.0
This article was previously published under Q236889 SYMPTOMS
Active Server Pages (ASP) script sends Microsoft JScript Boolean values to the client as "True" and "False" instead of "true" and "false". JScript is case-sensitive and expects "true" and "false" for Boolean values, so the values "True" and "False" do not work.
RESOLUTION
A workaround is to create a helper function that converts the "True" and "False" strings to all lowercase before writing them to the browser. Below is a sample:
<%@ LANGUAGE="JScript" %>
<%
var n = "0";
var x = "0";
var y = "0";
x = (n == "1");
y = (n == "0");
function convertboolean(boolval)
{
boolval = boolval.toString().toLowerCase();
return boolval;
}
%>
<html>
<head></head>
<body>
<P>
Checkbox1 <INPUT id=Checkbox1 type=checkbox><BR>
Checkbox2 <INPUT id=Checkbox2 type=checkbox>
<script language="JScript">
Checkbox1.checked = <%= convertboolean(x)%>;
Checkbox2.checked = <%= convertboolean(y)%>;
</script>
</body>
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 6/24/2004 |
---|
Keywords: | kbbug kbScript KB236889 |
---|
|