Venkatachari
Programmer
Dear All,
I am having 2 combo, combo1 and combo2
combo1 is loaded with city,
according to the selection of the city, state will be loaded.
i have written the code in onstatus event of city,
it is working fine
pl. check the code
Now the problem is since i am submiting the page, i am unable to retain the
selected value of the city. how could i acheive this?
<tr>
<th align=left ><font color=black>City</font></th>
<td>
<select name="cmbCity" onChange="javascript: CheckStatus('State'); submit();" > <!-- onChange= "javascript:alert(document.frmAddress1.cmbCity.value)" value="<%=request("cmbCity")%>" -->
<%
dim varCity
if cn.state = 1 then
cn.close
end if
Cn.open
if err.number <> 0 then
response.write err.description
response.end
end if
set Rs = server.createobject("Adodb.Recordset")
Rs.ActiveConnection = Cn
Rs.Cursortype = adOpenForwardOnly
Rs.CursorLocation = adUseClient
Rs.LockType = adLockOptimistic
Rs.Open "Select mCity_Name from mCity group by mCity_Name order by mCity_Name"
While not rs.eof
response.write "<option value = '" & rs.fields("mCity_Name") & "'>" & rs.fields("mCity_Name") & "</option>"
rs.movenext
wend
rs.close
Cn.Close
%>
</select>
</td>
</tr>
<tr>
<th align=left ><font color=black>State</font></th>
<td>
<select name="cmbState" value="<%=request("cmbState")%>" >
<%
dim varState
strSql = "Select mCity_State, mCity_Country from mCity where mCity_Name = '" & request("cmbCity") & "'"
varCity = request("cmbCity")
cn.open
set tmpRs = server.createObject("Adodb.Recordset")
tmpRs.ActiveConnection = Cn
tmpRs.CursorLocation = adUseClient
tmpRs.CursorType = adOpenDynamic
tmpRs.LockType = adLockOptimistic
tmprs.open strSql
varState=""
if not tmprs.eof then
varState = tmprs.fields("mCity_Country") & ""
end if
While not tmprs.eof
response.write "<option value = '" & tmprs.fields("mCity_State") & "'>" & tmprs.fields("mCity_State") & "</option>"
tmprs.movenext
wend
tmprs.close
set tmprs = nothing
cn.close
%>
</select>
</td>
</tr>
I am having 2 combo, combo1 and combo2
combo1 is loaded with city,
according to the selection of the city, state will be loaded.
i have written the code in onstatus event of city,
it is working fine
pl. check the code
Now the problem is since i am submiting the page, i am unable to retain the
selected value of the city. how could i acheive this?
<tr>
<th align=left ><font color=black>City</font></th>
<td>
<select name="cmbCity" onChange="javascript: CheckStatus('State'); submit();" > <!-- onChange= "javascript:alert(document.frmAddress1.cmbCity.value)" value="<%=request("cmbCity")%>" -->
<%
dim varCity
if cn.state = 1 then
cn.close
end if
Cn.open
if err.number <> 0 then
response.write err.description
response.end
end if
set Rs = server.createobject("Adodb.Recordset")
Rs.ActiveConnection = Cn
Rs.Cursortype = adOpenForwardOnly
Rs.CursorLocation = adUseClient
Rs.LockType = adLockOptimistic
Rs.Open "Select mCity_Name from mCity group by mCity_Name order by mCity_Name"
While not rs.eof
response.write "<option value = '" & rs.fields("mCity_Name") & "'>" & rs.fields("mCity_Name") & "</option>"
rs.movenext
wend
rs.close
Cn.Close
%>
</select>
</td>
</tr>
<tr>
<th align=left ><font color=black>State</font></th>
<td>
<select name="cmbState" value="<%=request("cmbState")%>" >
<%
dim varState
strSql = "Select mCity_State, mCity_Country from mCity where mCity_Name = '" & request("cmbCity") & "'"
varCity = request("cmbCity")
cn.open
set tmpRs = server.createObject("Adodb.Recordset")
tmpRs.ActiveConnection = Cn
tmpRs.CursorLocation = adUseClient
tmpRs.CursorType = adOpenDynamic
tmpRs.LockType = adLockOptimistic
tmprs.open strSql
varState=""
if not tmprs.eof then
varState = tmprs.fields("mCity_Country") & ""
end if
While not tmprs.eof
response.write "<option value = '" & tmprs.fields("mCity_State") & "'>" & tmprs.fields("mCity_State") & "</option>"
tmprs.movenext
wend
tmprs.close
set tmprs = nothing
cn.close
%>
</select>
</td>
</tr>