msdnexpert
Jun 5th, 2000, 01:35 PM
Hello there,
I have a very simple question. I have got 2 radio buttons on a form. I am querying the database and retrieving data and accordingly trying to set/reset the radio buttons. I do not know how to set/reset the radio buttons using the document object. All help is appreciated. Thanks in advance.
The code snippet(actually the entire asp) is given below.
<HTML>
<HEAD>
Employee Information
</HEAD>
<BODY>
<FORM METHOD=GET NAME="F1">
<table>
<tr>
<td>Name:
<td><INPUT TYPE=TEXT NAME="cab_name_1" MAXLENGTH=50 VALUE="" READONLY>
<tr>
<td>Marital Status:
<td>
<INPUT TYPE="RADIO" NAME="maritalstatus_1" VALUE="1" CHECKED>Married
<INPUT TYPE="RADIO" NAME="maritalstatus_1" VALUE="0" >UnMarried
</table>
</FORM>
<%
Dim cnn, i
Dim rscount
Dim strValue
Dim strquotes
strquotes = """"
set cnn = Server.CreateObject("ADODB.Connection")
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\dgoffice.mdb"
cnn.Open
Set rscount = cnn.Execute("SELECT * FROM tmp where page_id=225")
For i = 0 to rscount.Fields.count - 1
Session(i) = strquotes + CStr(rscount.fields(i).value) + strquotes
Next
cnn.Close
%>
<SCRIPT LANGUAGE=VBSCRIPT>
Dim theForm
Dim strtmp, j
Set theForm = document.Forms(0)
theForm.cab_name_1.value = <%= Session(0) %>
<!-- Here lies my problem -->
<!-- Now then how do I set the radio buttons. I have tried the following but it does not work -->
if theForm.maritalstatus_1(0) = "on" then
theForm.cab_fol_count_1.value = "ON"
else
theForm.cab_fol_count_1.value = "OFF"
end if
</SCRIPT>
</BODY>
</HTML>
I have a very simple question. I have got 2 radio buttons on a form. I am querying the database and retrieving data and accordingly trying to set/reset the radio buttons. I do not know how to set/reset the radio buttons using the document object. All help is appreciated. Thanks in advance.
The code snippet(actually the entire asp) is given below.
<HTML>
<HEAD>
Employee Information
</HEAD>
<BODY>
<FORM METHOD=GET NAME="F1">
<table>
<tr>
<td>Name:
<td><INPUT TYPE=TEXT NAME="cab_name_1" MAXLENGTH=50 VALUE="" READONLY>
<tr>
<td>Marital Status:
<td>
<INPUT TYPE="RADIO" NAME="maritalstatus_1" VALUE="1" CHECKED>Married
<INPUT TYPE="RADIO" NAME="maritalstatus_1" VALUE="0" >UnMarried
</table>
</FORM>
<%
Dim cnn, i
Dim rscount
Dim strValue
Dim strquotes
strquotes = """"
set cnn = Server.CreateObject("ADODB.Connection")
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\dgoffice.mdb"
cnn.Open
Set rscount = cnn.Execute("SELECT * FROM tmp where page_id=225")
For i = 0 to rscount.Fields.count - 1
Session(i) = strquotes + CStr(rscount.fields(i).value) + strquotes
Next
cnn.Close
%>
<SCRIPT LANGUAGE=VBSCRIPT>
Dim theForm
Dim strtmp, j
Set theForm = document.Forms(0)
theForm.cab_name_1.value = <%= Session(0) %>
<!-- Here lies my problem -->
<!-- Now then how do I set the radio buttons. I have tried the following but it does not work -->
if theForm.maritalstatus_1(0) = "on" then
theForm.cab_fol_count_1.value = "ON"
else
theForm.cab_fol_count_1.value = "OFF"
end if
</SCRIPT>
</BODY>
</HTML>