By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,403 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,403 IT Pros & Developers. It's quick & easy.

How to associate the value of dropdown with checkbox

P: n/a
Hi All,

I have the following case.

I am trying to update a table based on the value of dropdown box and
checkbox.

Here is what I have in page1.asp

<table>

<tr>
<td>STATUS</td>
<td>Claim Number</td>
<td>Select</td>
</tr>

<form name=form action='Page2.asp' method='post'>
<%dim I : I=1
do while not rs.EOF%>

<tr>
<td>
<select name="selStatus">
<option value="A" selected>A</option>
<option value='P'>P</option>
<option value='D'>D</option>
</select>
</td>

<td><%=rs("Claim_Number")%></td>
<td><input type='checkbox' name='chk<%=i%>'
value='<%=rs("Claim_Number")%>'></td>
</tr>

<%rs.MoveNext
I = I + 1
Loop
%>

<tr align='center' bgcolor='white'>
<td><input type="submit" value="Submit" name="cmdSubmit">
<input type='hidden' name='No_of_Records' value='<%=I%>'>
</td>
</tr>
</form>

</table>

Now in page2.asp, I need to update data based on which checkbox was
checked and what was selected in the STATUS field
which is A, P and D.
I have the following code in page2.asp:

if Len(Request.Form("cmdSubmit"))>0 then

dim JJ
dim No_Of_Records, strClaimID, strStatusCD
No_Of_Records=Request.Form("No_of_Records")

For JJ=0 to No_Of_Records-1
if Request.Form("chk" & JJ)<>"" then
strClaimID=Request.Form("chk" & JJ)
qry="Update warx065_srs set VENSTATCDE='" & strStatusCD & "' where
ClaimNumber='" & strClaimID & "'"

Conn.Execute(qry)
end if
Next
end if
The code in page2.asp selects the right claim Number but not the right
status.

For ex. if I check 2 checkboxes and run the query I get the following:

Update table1 set VENSTATCDE='A, A, D, A, A, A, A, A, A, A, A, A, A,
A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
A, A, A, A, A, A, A, A, A, A, A, A, A, A' where ClaimNumber='K90611'
Update table1 set VENSTATCDE='A, A, D, A, A, A, A, A, A, A, A, A, A,
A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,
A, A, A, A, A, A, A, A, A, A, A, A, A, A' where ClaimNumber='K93632'
I have 50 records in each page.
How can I associate the value of dropdown with checkbox in this case.

I would highly appreciate your help.

Thanks a lmillion in advance.

best regards,

mamun
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.