Jamie,

>I have a simple sortable list of div's with one containing a group of
>radio buttons, such as:
><div id="container">
>        <div>Item 1 <input type="radio" name="obj" value="K" /><input
>type="radio" name="obj" value="D" /></div>
>            <div>Item 2</div>
>            <div>Item 3</div>
>            <div>Item 4</div>
>            <div>Item 5</div>
></div>
>
>If I check one of the radio buttons and then drag the first Item, once
>the div is "dropped" the value of the radio button gets unset.  Why is
>that?
>
>It appears that in Firefox 2.0.0.12 on Windows Vista that if I set a
>CHECKED value for one of the radio buttons it doesn't get recognized
>and then when the Item is "sorted" the radio buttons revert to their
>previous unchecked state.  In IE7 on Vista, the CHECKED attribute is
>recognized as desired, but if I click on the other radio button and
>therefore change what was set by default once the item has been
>"sorted" the radio button reverts to its original default state.  So
>it appears that when sorting div that contain radio buttons all of the
>radio buttons are reset to their default states as dictated by the
>HTML.  How do I fix this so that the value changes are carried forward
>when an item has been changed and then subsequently sorted afterwards?
>
>I tried fooling around with something like this:
>$("[EMAIL PROTECTED]'obj']").click(
>                function(){
>                        $
>("[EMAIL PROTECTED]'obj']").removeAttr('checked');  // Remove all
>checked radio buttons first
>                        $(this).attr('checked','checked');  //Check
>the appropriate radio
>button
>                });
>
>Didn't work.  The removeAttr works properly, but the add attribute
>portion doesn't.  However, if I use a bogus attribute instead of
>"checked" it works (as far as removing and adding the bogus attribute
>in the appropriate spot).  I'm stumped...
>
>And just fyi, this is my first time using jQuery, so speak relatively
>juvenile and I promise not to get too offended.  :-)  Thanks in
>advance!

Without knowing how your doing the drag-n-drop, it's hard to say. I'll
assume somewhere along the way the dragged element is getting cloned--which
can cause the loss of form state:

http://blog.pengoworks.com/index.cfm/2007/7/16/IE6--IE7-quirks-with-cloneNod
e-and-form-elements

-Dan

Reply via email to