Microsoft KB Archive/236889

= BUG: JScript from ASP Page Sends Mixed-Case Boolean Values to Client =

Article ID: 236889

Article Last Modified on 6/24/2004

-

APPLIES TO


 * Microsoft Active Server Pages 4.0
 * Microsoft Internet Information Server 4.0
 * Microsoft Internet Information Services 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; } %>  Checkbox1  Checkbox2   Checkbox1.checked = <%= convertboolean(x)%>; Checkbox2.checked = <%= convertboolean(y)%>;



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
  Create an ASP page with the following code: <%@ LANGUAGE="JScript" %> <% var n = "0"; var x = "0"; var y = "0"; x = (n == "1"); y = (n == "0"); %>  Checkbox1  Checkbox2  <script language="JScript"> Checkbox1.checked = <%= x%>; Checkbox2.checked = <%= y%>; </li> <li>Save the ASP page to the root directory of the default Web site on an Internet Information Server.</li> <li>Browse to the page with a Web browser.

Notice that neither checkbox is selected, although you would expect Checkbox 2 to be selected.

NOTE: If you are using Internet Explorer 5.0 and have selected Display a notification about every script error on the Advanced tab of the Internet Options window (which is accessed from the Tools menu), the following error message occurs:

A Runtime Error has occurred.

Do you wish to Debug?

Line: 8

Error: 'False' is undefined

</li></ol>

Keywords: kbbug kbscript KB236889

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.