checkboxes! URGENT

Discussion in 'ASP General' started by VbUser25, Jan 6, 2005.

  1. VbUser25

    VbUser25 Guest

    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


    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
    VbUser25, Jan 6, 2005
    #1
    1. Advertising

  2. VbUser25

    Steven Burn Guest

    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!

    "VbUser25" <> wrote in message
    news:#...
    >
    >
    > 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
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!
    Steven Burn, Jan 6, 2005
    #2
    1. Advertising

  3. VbUser25

    Jeff Cochran Guest

    On Thu, 06 Jan 2005 00:48:26 -0800, VbUser25
    <> wrote:

    >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
    Jeff Cochran, Jan 6, 2005
    #3
  4. VbUser25

    Guest

    VbUser25 wrote:
    > 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
    , Jan 6, 2005
    #4
  5. VbUser25

    Roland Hall Guest

    "VbUser25" wrote in message news:%...
    :
    : 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
    Roland Hall, Jan 6, 2005
    #5
  6. VbUser25

    dp Guest

    VbUser25 wrote:
    > 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
    >
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!


    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.

    --
    dp
    dp, Jan 8, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fresh Air Rider

    Checkboxes with Repeaters and DataGrids

    Fresh Air Rider, Mar 5, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    481
    Fresh Air Rider
    Mar 5, 2004
  2. kannadasan
    Replies:
    1
    Views:
    1,002
  3. Sachin Jagtap

    URGENT !! QUEUE STL PROBLEM URGENT!!

    Sachin Jagtap, Apr 28, 2005, in forum: C++
    Replies:
    4
    Views:
    1,028
    Mark Stijnman
    Apr 29, 2005
  4. Rob
    Replies:
    3
    Views:
    426
  5. Replies:
    1
    Views:
    252
Loading...

Share This Page