checkboxes! URGENT

V

VbUser25

hi
i need urgent responses..

i have some 15 checkboxex on a form... i want to 1st check the no. of
checkboxes that are checked?? and then loop it that many times adn
insert the quantities the user enters in the text boxes.

do i need to group the checkboxes....hwo can i do that??? how to know
which checkbox is checked because out of the 15 checkbox say 1,5,7, 9th
are checked then i 1st need to get the id from the database adn then
based on htat id retrieved i need to insert values on another table.

pls suggest with a code.

thanks a lot
 
S

Steven Burn

I'm sorry, everyone is busy dealing with other people's "urgent" demands,
please check back later.

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
J

Jeff Cochran

i need urgent responses..

Usenet newsgroups aren't the best method for getting responses on your
time table. Most of us read these groups according to *our*
timetable.
i have some 15 checkboxex on a form... i want to 1st check the no. of
checkboxes that are checked?? and then loop it that many times adn
insert the quantities the user enters in the text boxes.

do i need to group the checkboxes....hwo can i do that??? how to know
which checkbox is checked because out of the 15 checkbox say 1,5,7, 9th
are checked then i 1st need to get the id from the database adn then
based on htat id retrieved i need to insert values on another table.

What's wrong with simply implementing a counter for whatever you want
to count?
pls suggest with a code.

Pseudocode:

Counter = 0
If Checkbox1 = Checked Then
Counter = Counter + 1
End If
If Checkbox2 = Checked Then
Counter = Counter + 1
End If
If Checkbox3 = Checked Then
Counter = Counter + 1
End If
Response.Write Counter

You can recode this a dozen different ways in whatever method you
wish, the principal is to increment the counter for each response you
want to count.

Jeff
 
L

larrybud2002

VbUser25 said:
hi
i need urgent responses..

i have some 15 checkboxex on a form... i want to 1st check the no. of
checkboxes that are checked?? and then loop it that many times adn
insert the quantities the user enters in the text boxes.

do i need to group the checkboxes....hwo can i do that??? how to know
which checkbox is checked because out of the 15 checkbox say 1,5,7, 9th
are checked then i 1st need to get the id from the database adn then
based on htat id retrieved i need to insert values on another table.

Each checkbox should be named so it's unique, but you know that it's a
checkbox. For example, each name would begin with

checkbox_xxx

Where xxx is the checkbox # in sequential order, a primary key in a
table, etc... something to make it unique

When the form is submitted, do a for...each loop

for each element in request.form
if left(request.form(element),9)="checkbox_" then
checkboxvalue=request.form(element)
checkboxnum=right(element, len(element)-9)

if checkboxvalue="1" then
'your code for when the checkbox is checked goes here.
end if
end if
next
 
R

Roland Hall

in message :
: hi
: i need urgent responses..

don't we all?

: i have some 15 checkboxex on a form... i want to 1st check the no. of
: checkboxes that are checked?? and then loop it that many times adn
: insert the quantities the user enters in the text boxes.
:
: do i need to group the checkboxes....hwo can i do that??? how to know
: which checkbox is checked because out of the 15 checkbox say 1,5,7, 9th
: are checked then i 1st need to get the id from the database adn then
: based on htat id retrieved i need to insert values on another table.

What you need is a spelling checker and for someone to do your homework.
This is an ASP NG, and you're requiring user intervention. That makes it a
client-side issue. If your form is submitted to the same page or another
then you use request.form to retrieve the values. This requires a
method="post" in your form. If you use method="get" you use
request.querystring on the server side.

You haven't stated which language you want to use or if a form is involved
to submit the form so it can be parsed, evaluated and processed. All of
this could be done on the client-side. You state you have check boxes and
suddenly text boxes appear in your message. You're not even sure how to
determine if a checkbox has been checked which means if you need that, you
need help no the client-side. ASP is server-side scripting.

Granted we all make spelling errors but yours are not spelling errors,
they're careless typing errors. If you do not show anymore care to solicit
help by correcting your errors, or at least making an attempt to, why should
we?

: pls suggest with a code.

Show us what you have so far as it will be easier to correct your code than
try to educate you on how it's done. Unless you're willing to pay, you're
going to miss your deadline. If it's homework, we'll help to point you to
the right material so you can educate yourself and get it written. Being
honest will get you more information although we won't do your homework for
you. If your goal is to just have someone do you work for you, then you're
in the wrong place and you've chosen the wrong career.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
D

dp

VbUser25 said:
hi
i need urgent responses..

i have some 15 checkboxex on a form... i want to 1st check the no. of
checkboxes that are checked?? and then loop it that many times adn
insert the quantities the user enters in the text boxes.

do i need to group the checkboxes....hwo can i do that??? how to know
which checkbox is checked because out of the 15 checkbox say 1,5,7,
9th are checked then i 1st need to get the id from the database adn
then based on htat id retrieved i need to insert values on another
table.

pls suggest with a code.

thanks a lot

Use 2's complement/binary type values - e.g.
Assign checkbox 1 a value of 1
Assign checkbox 2 a value of 2
Assign checkbox 3 a value of 4
Assign checkbox 4 a value of 8
Assign checkbox 5 a value of 16
Sum the values so you only have 1 numeric db entry containing the total
value.

Write your self a little subtraction function...

e.g. if check boxes 2 and 4 were checked, the db value would be 10.
10 is not => than 16, so check box 5 is not checked
10 is => than 8 so check box 4 is checked, Subtract 8 from the value (10)
giving a new value of 2
2 is not => than 4, so check box 3 is not checked
2 is => than 2 , so check box 2 is checked, subtract 2 from the value (2)
giving you 0
If value = 0, nothing else is checked.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top