51 users online (1 members and 50 guests)  


  Results 1 to 8 of 8

Related

  1. VBScript/Html Help    Forum: HTML Forum
    Replies: 1
  2. Vbscript/html Checkbox    Forum: HTML Forum
    Replies: 0
  3. Variable problems in HTML / Vbscript    Forum: HTML Forum
    Replies: 0
  4. VBscript difficulty    Forum: Website Scripts Forum
    Replies: 1
  5. HTML/VBSCRIPT checkbox help...please    Forum: Website Scripts Forum
    Replies: 4
  1. #1
    TBird2424's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2004
    Location
    Pittsburgh, PA
    Posts
    7

    Question HTML/VBSCRIPT checkbox help

    I am new to this forum and new to VBScript/Programming.

    I am developing a program that builds a list from a database using the variables that the user has put in. I want to be able to put a check box on each line to allow the user to remove any names that user does not want. I am unable, however, to setup a unique name for each check box. I am wonder how this is done. Here is my code:

    oRSp.MoveFirst
    do while NOT oRSp.EOF
    response.write ("<td><input type=checkbox name=C1 value-true</td>")
    response.write "<td>&nbsp;</td>"
    response.write "<td>&nbsp;</td>"
    response.write "<td>&nbsp;</td>"
    response.write "<td>" & oRSp("LastName") & "</td>"
    response.write "<td>" & oRSp("FirstName") & "</td>"
    response.write "<td>" & oRSp("Address") & "</td>"
    response.write "<td>" & oRSp("Phone") & "</td>"
    response.write "<td>" & oRSp("Special") & "</td>"
    response.write "<td>" & oRSp("Notes") & "</td></tr>"
    oRSp.MoveNext
    Loop

    Any help would be appreciated.

    Thanks

    Jeff Moore(TBird2424)
    Last edited by TBird2424; 03-10-2004 at 09:36 AM.

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Hi, welcome to the forums.

    If your database has a unique field (typically an autonumber field) then you can write that out into the checkbox name, thus giving you a unique checkbox name.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    TBird2424's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2004
    Location
    Pittsburgh, PA
    Posts
    7

    Question

    Thank you for the info and that is a great idea. However, I am unable to get the script to use the field. Would it be possible to see an example of how this would be done. I know I sound like a total idiot but I have not found much information on this part of the programming on the web nor in books.

    Thank you in advance.

    Jeff Moore(TBird2424)

    Quote Originally Posted by QuietDean
    Hi, welcome to the forums.

    If your database has a unique field (typically an autonumber field) then you can write that out into the checkbox name, thus giving you a unique checkbox name.

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    No examples off-hand. I have done this, but only in work on our intranet. They would get shirty if I post that code

    Maybe some of our other members have examples.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    TBird2424's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2004
    Location
    Pittsburgh, PA
    Posts
    7

    Talking

    QuietDean, I just wanted to let you know that I figured it out. Thanks for the help.

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Brilliant.

    How about sharing the solution?It might help others in future
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  7. #7
    TBird2424's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2004
    Location
    Pittsburgh, PA
    Posts
    7

    Talking

    Using QuietDean's suggestion of using the key as the unique identifier for each check box, the problem was getting it to do this in a loop fashion. The following is the code that I came up with. The key code is in bold. This code puts builds a table as well.

    oRSp.MoveFirst
    do while NOT oRSp.EOF
    If oRSp("Run") = 1 then
    response.write ("<td><input type=checkbox name=" & oRSp("Key") & " value-true</td>")
    response.write "<td>&nbsp;</td>"
    response.write "<td>&nbsp;</td>"
    response.write "<td>&nbsp;</td>"
    response.write "<td>" & oRSp("LastName") & "</td>"
    response.write "<td>" & oRSp("FirstName") & "</td>"
    response.write "<td>" & oRSp("Address") & "</td>"
    response.write "<td>" & oRSp("Phone") & "</td>"
    response.write "<td>" & oRSp("Special") & "</td>"
    response.write "<td>" & oRSp("Notes") & "</td></tr>"
    End If
    oRSp.MoveNext
    Loop

  8. #8
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Nice! thanks for sharing.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread