PRB: Radio Button Does Not Bind Correctly to Boolean
ID: Q185566
|
The information in this article applies to:
-
Internet Client SDK, versions 4.0, 4.01
on the following platforms: NT, Win95, x86
SYMPTOMS
<INPUT> tags of type RADIO do not seem to bind to Boolean data correctly.
This would occur in a RADIO group where one RADIO button would have a value
of "true" and the other would have the value or "false."
CAUSE
For reasons that are apparent when you consider a text column bound to a
text box, the string comparisons are case-sensitive. Zero and 1 are
converted to "False" and "True" (notice the uppercase letters),
respectively.
When a record from a bound data source is navigated to, the DATAFLD that
the RADIO button is bound to is evaluated and converted to "True" or
"False" before deciding which RADIO button to select. If the RADIO button's
values are set to "true" and "false" (notice the lowercase letters), then
the value returned from the data source would be equal to neither. For this
reason, neither RADIO button will be selected.
RESOLUTION
If you change "true" and "false" in your page to "True" and "False,"
respectively, the page will behave as you desire.
STATUS
This behavior is by design.
MORE INFORMATION
Sample of Incorrect HTML
This is a sample page that show one RADIO values correctly and the other one incorrectly set for Databinding to a Boolean field:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
<SCRIPT LANGUAGE=VBSCRIPT>
Sub btnNext_OnClick()
RDS1.recordset.MoveNext
If RDS1.recordset.eof Then
RDS1.recordset.MoveFirst
End If
End Sub
</SCRIPT>
</HEAD>
<BODY>
<!-- RDS.DataControl -->
<OBJECT classid=clsid:BD96C556-65A3-11D0-983A-00C04FC29E33 height=1 id=RDS1
width=1>
<PARAM NAME="SERVER" VALUE="HTTP://YOURSERVER">
<PARAM NAME="CONNECT" VALUE="DSN=NWIND;">
<PARAM NAME="SQL" VALUE="SELECT * FROM PRODUCTS">
</OBJECT>
<P> </P>
<INPUT NAME=rdoDiscontinued TYPE=RADIO DATASRC=#RDS1 DATAFLD=Discontinued Value="True">True (When Discontinued, this radio button will be selected.)<BR>
<INPUT NAME=rdoDiscontinued TYPE=RADIO DATASRC=#RDS1 DATAFLD=Discontinued
Value="false">false (This one will never be selected)<BR>
Discontinued:<INPUT NAME=txtDiscontinued TYPE=TEXT DATASRC=#RDS1 DATAFLD=Discontinued readonly><BR>
<INPUT TYPE=BUTTON NAME=btnNext VALUE="NEXT">
</BODY>
</HTML>
REFERENCES
For more information, please see the MSDN Web Workshop:
http://msdn.microsoft.com/workshop/default.asp
Additional query words:
MHarper kbDSupport kbdsi kbDHTML kbDataBinding kbIE400 kbInternet
Keywords : kbIE500
Version : WINDOWS:4.0,4.01
Platform : WINDOWS
Issue type : kbprb