Pesky cloneNode behavior with radio buttons as child nodes

    Date: 10/06/06 (Javascript Community)    Keywords: java

    I created a form that allows users to add information about employment history. It starts with a single set of employer information fields, but users can click an "add employer" button to dynamically add additional sets of employers to the form.

    Originally I used cloneNode to clone the original employer, insert the clone into the form, set new ids and names, and set all the values to null for the newly inserted employer. This worked for everything except the radio buttons. If any radio buttons are selected for the original employer, Firefox loses the selection. IE keeps the selection, but then treats the new radio buttons as part of the same set (in spite of their different names).

    I threw together a quick "pets" example that I hope will better illustrate the problem:
    cloneNode and dynamic forms with javaScript

    I feel like there's a good solution that I am either not thinking of or just don't know about—I'm hoping you guys might have some suggestions.

    Source: http://community.livejournal.com/javascript/114276.html

« Disabling a form submit button || Disjointed Rollovers with... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home