Checkbox Issues

K

Kevin Davis

Hello,

I have the following problem with the checkbox. The issue seems to be
that when I click on the following checkbox:

<input type= checkbox id="checkbox1" name="<%response.Write "recount"
& CoCount%>" value="<%=idx%>" >

with the following values below:

<input type=hidden name="recount" value=<%=idx%>>
<input type=hidden name="contactname"
value="<%=oDodgeCos3("f_person") %>" id=hidden1>
<input type=hidden name="drnum" value="<%=request("dr_num")%>"
id=hidden2>
<input type=hidden name="companyname"
value="<%=oDodgeCos3("f_comp_name")%>" id = hidden3>
<input type=hidden name="address"
value="<%=oDodgeCos3("f_addr1")%>" id=hidden4>
<input type=hidden name="city"
value="<%=oDodgeCos3("f_city")%>" id=hidden5>
<input type=hidden name="state"
value="<%=oDodgeCos3("f_state")%>" id=hidden6>
<input type=hidden name="zip" value="<%=oDodgeCos3("f_zip")%>"
id=hidden7>
<input type=hidden name="phone"
value="<%=oDodgeCos3("f_phone")%>" id=hidden8>
<input type=hidden name="fax"
value="<%=oDodgeCos3("f_fax_nbr")%>" id=hidden9>


The problem is that when I click on the box, it seems that the all
values is being passed over to the next page.

How would I have the values passed over based upon the checkbox that
the user select?

Thanks!
Kevin Davis
 
M

Mike Brind

Kevin said:
Hello,

I have the following problem with the checkbox. The issue seems to be
that when I click on the following checkbox:

<input type= checkbox id="checkbox1" name="<%response.Write "recount"
& CoCount%>" value="<%=idx%>" >

with the following values below:

<input type=hidden name="recount" value=<%=idx%>>
<input type=hidden name="contactname"
value="<%=oDodgeCos3("f_person") %>" id=hidden1>
<input type=hidden name="drnum" value="<%=request("dr_num")%>"
id=hidden2>
<input type=hidden name="companyname"
value="<%=oDodgeCos3("f_comp_name")%>" id = hidden3>
<input type=hidden name="address"
value="<%=oDodgeCos3("f_addr1")%>" id=hidden4>
<input type=hidden name="city"
value="<%=oDodgeCos3("f_city")%>" id=hidden5>
<input type=hidden name="state"
value="<%=oDodgeCos3("f_state")%>" id=hidden6>
<input type=hidden name="zip" value="<%=oDodgeCos3("f_zip")%>"
id=hidden7>
<input type=hidden name="phone"
value="<%=oDodgeCos3("f_phone")%>" id=hidden8>
<input type=hidden name="fax"
value="<%=oDodgeCos3("f_fax_nbr")%>" id=hidden9>


The problem is that when I click on the box, it seems that the all
values is being passed over to the next page.

How would I have the values passed over based upon the checkbox that
the user select?

Thanks!
Kevin Davis

What does your second page do? Your requirement isn't entirely clear.
 
K

Kevin Davis

Basically on the next page there is a form that stores the information
based upon the information. For example, I would click on both records
and I would only like to see the first record first then the next
record an so on. Basically the second page allows the user to modify
the data.
 
L

Larry Bud

Kevin said:
Hello,

I have the following problem with the checkbox. The issue seems to be
that when I click on the following checkbox:

<input type= checkbox id="checkbox1" name="<%response.Write "recount"
& CoCount%>" value="<%=idx%>" >

with the following values below:

<input type=hidden name="recount" value=<%=idx%>>
<input type=hidden name="contactname"
value="<%=oDodgeCos3("f_person") %>" id=hidden1>
<input type=hidden name="drnum" value="<%=request("dr_num")%>"
id=hidden2>
<input type=hidden name="companyname"
value="<%=oDodgeCos3("f_comp_name")%>" id = hidden3>
<input type=hidden name="address"
value="<%=oDodgeCos3("f_addr1")%>" id=hidden4>
<input type=hidden name="city"
value="<%=oDodgeCos3("f_city")%>" id=hidden5>
<input type=hidden name="state"
value="<%=oDodgeCos3("f_state")%>" id=hidden6>
<input type=hidden name="zip" value="<%=oDodgeCos3("f_zip")%>"
id=hidden7>
<input type=hidden name="phone"
value="<%=oDodgeCos3("f_phone")%>" id=hidden8>
<input type=hidden name="fax"
value="<%=oDodgeCos3("f_fax_nbr")%>" id=hidden9>


The problem is that when I click on the box, it seems that the all
values is being passed over to the next page.

That's how it should work. All values on the form get passed to the
next page. It's up to your code on the next page to determine what
happens if a certain checkbox was checked.
 
M

Mike Brind

Kevin said:
Basically on the next page there is a form that stores the information
based upon the information. For example, I would click on both records
and I would only like to see the first record first then the next
record an so on. Basically the second page allows the user to modify
the data.

Your reply is even more confusing than the original :)

Let's have a stab at this: The first page is supposed to represent all
records that can be edited, with checkboxes by each one so that the
user can tick the checkboxes against the records they want to update.
This information is passed over to the next page, presenting the
selected records in editable format. The second page then processes
any changes made to any of the records. Is that right?

If it is, then you do not need all the hidden fields on the first page.
Just the ID number for each record will do as the value for the
checkbox - making sure that the checkboxes all share the same name.
All the selected checkboxes will be passed in the Form collection as a
comma-separated string eg: Response.Write Request.Form("checkbox") will
give you 1,2,4,6,9 (if those were the selected checkboxes).

After validating Request.Form("checkbox") you just need to use the SQL
IN clause to select those records:

sql = "SELECT fields FROM table WHERE ID IN(" &
Request.Form("checkbox") & ")"

What will increase the difficulty of your task on the second page is
presenting all records in an editable format. You will have to append
the form field names with a counter so you can identify which, say,
surname belongs to which record being updated.

Hope I've guessed what you are trying to do correctly...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,142
Messages
2,570,819
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top