[Webkit-unassigned] [Bug 57819] New: Radio Button checked state is removed after appending it dynamically via javascript several times

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 5 01:38:44 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=57819

           Summary: Radio Button checked state is removed after appending
                    it dynamically via javascript several times
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: Macintosh Intel
        OS/Version: Mac OS X 10.6
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Forms
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: maximilian.zimmer at inneresauge.com


I'm currently working on a form-intensive site that lets people edit previously submitted forms that have been dynamically added to the page via javascript (unfortunately I don't have an url to demonstrate the behavior). I'm using jQuery 1.5.1 and the behavior only occurs in webkit based browsers.

On edit I loop through a set of radio buttons, verify which one is checked and create a new element for each radio button with the checked one having the checked attribute set to checked and append them to the new form (example code: answer.append('<input type="radio" name="correct-edit" ' + checked + ' />');).

On save the same happens in a reverse way, I loop once again through the radio buttons, recreate them with the currently checked one set checked="checked" and append them (example code: $('<div class="answer"></div>').append('<input type="radio" ' + checked + ' disabled="disabled" /><label>' + answer_text + '</label>');).

Repeating the edit/save process 3 times (edit then save, edit then save, edit) causes the checked state of the radio button that is supposed to be checked to disappear, although inspecting the element shows that the checked attribute is still set to checked. This happens both when leaving the the checked radio button the same or selecting different radio buttons. When retrieving the value of the checked attribute it shows through for the first two edits and false for the third, even though the attribute appears as checked in the source code. This also happens regardless of whether the radio buttons have a name attribute or not.

Here is a link to a post from someone in the jquery forum that seems to have the same/similar problem and found a (non-ideal) workaround: http://forum.jquery.com/topic/answer-injecting-radio-buttons-in-webkit

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list