I'm using the following code to pull productnames and extensions of the products into a form, and I want to submit the data back to the database later.
The problem is with this bit of code
<option value="location.href='exis
tingRecord
.asp?str=<
%=objRS("P
roductName
")%>'" <%if request.querystring("str")
=objRS("Pr
oductName"
) then response.write "selected" end if%>> <%=objRS("ProductName")%><
/option>
in the source of the working page the Value of the string ends up apearing as a large string including "location.href='existingRe
cord.asp?s
tr=<%" instead of just the ProductName.
Can anything be done to fix this?
And is there a way of getting around the page submitting to itself? can this be done in the background?
<td>Product Type <%
Dim ConnString
ConnString = "DSN=DBSERVER;uid=dba;pwd=
test"
Dim objConn
Set objConn = Server.CreateObject("ADODB
.Connectio
n")
objConn.ConnectionString = ConnString
objConn.Open
%>
<%
dim objSQL, objRS
objSQL = "select ProductName from SerialRanges where Status = 'A' and PType ='x' "
set objRS = objConn.execute(objSQL)
%>
<script language="Javascript">
function doSel(obj)
{
for (i = 0; i < obj.length; i++)
if (obj[i].selected == true)
eval(obj[i].value);
}
</script>
<select name="ProductName" Class="form" onchange="doSel(this)">
<%
do while not objRS.EOF
%>
<option value="location.href='exis
tingRecord
.asp?str=<
%=objRS("P
roductName
")%>'" <%if request.querystring("str")
=objRS("Pr
oductName"
) then response.write "selected" end if%>> <%=objRS("ProductName")%><
/option>
<%
objRS.movenext
loop
%>
</select>
<%
objRS.close
set objRS = nothing
%>
</td>
<td>Units <input type="text" name="Units" size="5" class="form"></td>
<td>From: XX-XX-XXXX To: XX-XX-XXXX </td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><table class="cellborder_content3
" width="100%" cellspacing="0" cellpadding="3" border="0">
<tr><td class="cellborder_content3
_purple">E
xtensions<
/td></tr><
/table>
<table class="cellborder_content3
" width="100%" cellspacing="0" cellpadding="3" border="0">
<tr>
<%
if request.querystring("str")
<> "" then
Dim objConn1
Set objConn1 = Server.CreateObject("ADODB
.Connectio
n")
objConn1.ConnectionString = ConnString
objConn1.Open
%>
<tr><td width="33%">Name</td><td width="33%">Units</td><td width="33%">Expiery Date</td></tr>
<%
dim objSQL1, objRS1
objSQL1 = "select ProductName from SerialRanges where PType = '" & request.querystring("str")
& "'"
set objRS1 = objConn1.execute(objSQL1)
do while not objRS1.EOF
%>
<tr> <td><input type="checkbox" name="chkbox" value="<%=objRS1("ProductN
ame")%>"><
%=objRS1("
ProductNam
e")%></td>
<td><input type="text" name="<%=objRS1("ProductNa
me")%>Unit
s" size="5" class="form"></td>
<td><input class="form" name="<%=objRS1("ProductNa
me")%>Expi
eryDate" type="text" size="10" /> <a href="javascript:calendar_
window=win
dow.open('
calendar.a
spx?formna
me=license
_activatio
n.<%=objRS
1("Product
Name")%>Ex
pieryDate'
,'calendar
_window','
width=154,
height=188
');calenda
r_window.f
ocus()"><i
mg src="images/calendar.gif" width="22" height="17" alt="" border="0"></a></td></tr>
<%
objRS1.movenext
loop
objRS1.close
set objRS1 = nothing
end if
%>
<%
objConn.close
set objConn = nothing
%>