Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    asp checkbox value/checked

    Hi All,
    I've building a webpage with a bunch of checkboxes on it (right now 31, but that will increase). Following is the INPUT code I am using to indicate that a checkbox is checked.

    <INPUT id="chkInput1" type="checkbox" value="3" name="chkInput"
    <%If InStr(strInput, "3") > 0 Then%>checked<%End If%>>
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: asp checkbox value/checked

    Try
    <code>
    ... If InStr(" " & strInput & ", ", " 3, ") Then ...
    </code>
    This will only process entire entries preceded by a space and followed by a comma and a space.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: asp checkbox value/checked

    Slick! <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>

    Thank you.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: asp checkbox value/checked

    Along the same lines, I like to use a delimiter character on all sides of each value, for example: +3+11+13+17+ Then I can match with +3+ and be positive of the match. (Actually, I ordinarily use the pipe character "|" but it's nonstandard and perhaps better not to use in web stuff.)

  5. #5
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: asp checkbox value/checked

    Thanks Jefferson,
    Just another example of how I can "look too far away" for an answer. As soon as I read Hans' reply, and then reinforced by yours........well, again, a <img src=/S/doh.gif border=0 alt=doh width=15 height=15> moment.
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •