PRB: Radio Button Does Not Bind Correctly to BooleanID: Q185566
|
<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."
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.
If you change "true" and "false" in your page to "True" and "False," respectively, the page will behave as you desire.
This behavior is by design.
<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>
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
Last Reviewed: May 7, 1999