Results 1 to 6 of 6

Thread: [RESOLVED] Check box bad behavior

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [RESOLVED] Check box bad behavior

    I've got a series of check box I drop into the DOM with jQuery - they come from a database call.

    When I check them on the screen the "top checkbox" keeps toggling as I click checkboxes below. Checkboxes from the second one down behave nicely - it's just that top one keep toggling on and off as I click any other checkbox.

    What can I do to track down the event causing this? I've been all over the place looking for it...

    HTML looks like this

    Code:
    <label class="awc-Message1 acs-seqEditPanel-3 acs-input-field">
    Presentation per providers
    <br>
    <br>
    <input type="checkbox" value="1" name="1">
    Anger
    <br>
    <input type="checkbox" value="2" name="2">
    Compulsions
    <br>
    <input type="checkbox" value="3" name="3">
    Delusions
    <br>
    <input type="checkbox" value="4" name="4">
    Depressed
    <br>
    <input type="checkbox" value="5" name="5">
    Disorganized
    <br>
    <input type="checkbox" value="6" name="6">
    Eating related issues
    <br>
    <input type="checkbox" value="7" name="7">
    Hallucinations
    <br>
    <input type="checkbox" value="8" name="8">
    High anxiety
    <br>
    <input type="checkbox" value="9" name="9">
    Homicidal ideation
    Attached Images Attached Images  

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Check box bad behavior

    I think it is because these checkboxes are in a label - seems you can only have one checkbox in a label.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Check box bad behavior

    Made the outer container a DIV - fixed the problem. Marking this resolved!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: [RESOLVED] Check box bad behavior

    Not sure if it matters in your job, but accessibility guidelines state you must have labels wrapped around all text associated with a textbox. Otherwise web-readers have issues navigating the site.

    So looking at your code, it should really be:

    Code:
    Presentation per providers
    <br>
    <br>
    <label for="1"><input type="checkbox" value="1" name="1" id="1">
    Anger</label>
    <br>
    <label for="2"><input type="checkbox" value="2" name="2" id="2">
    Compulsions</label>
    <br>
    <label for="3"><input type="checkbox" value="3" name="3" id="3">
    Delusions</label>
    etc
    You can also wrap it around just the text, and not the textbox, but I do the former because of bootstrapisms.

  5. #5

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [RESOLVED] Check box bad behavior

    Yeah - I've read about that as I just learned the purpose of a LABEL around a CHECKBOX. I don't really have to deal with these issues - although I probably should.

    I just happened to use a label since my jQuery code was only linking the database calls to things like LABELS, TEXTBOXES (I auto-bind the FIELD NAME to a CLASS-name I put on items - that was the AWC-MESSAGE1 class)

    I changed it to a DIV - altered some of my code to like that DIV - and it's working now.

    The problem I have with those CHECKBOXES setup like you indicate is that a user can open many tabs at once for different participants. I would have to name them really strangely to get them unique - like with the PARTICIPANT ID as part of the NAME and FOR links.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  6. #6
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: [RESOLVED] Check box bad behavior

    When placing the <input> inside a <label> you don't need the "for" attribute, so you can also remove the id attributes on your <input> controls.

    http://dochub.io/#html/label
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

Posting Permissions

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



Click Here to Expand Forum to Full Width