Closed Bug 99352 Opened 23 years ago Closed 23 years ago

dynamically created radio buttons do not group

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 98
defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 14445

People

(Reporter: douglas, Assigned: jst)

Details

From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)
BuildID:    20010726

When creating radio buttons by a script, the NAME parameter does not properly 
bind the radio buttons to form a radio button group.

Reproducible: Always
Steps to Reproduce:
d = document.createElement('INPUT');
d.setAttribute('type', 'radio');
d.setAttribute('name', group);
d.setAttribute('checked', value);
parent.appendChild(d);

Actual Results:  The buttons made by the above script are not grouped, and so 
are nonfunctional.

Expected Results:  A script should be able to generate a radio button group.
*** Bug 99353 has been marked as a duplicate of this bug. ***
There are a number of bugs relating to creating form elements dynamically.
This is probably a dup of one of them, but I can't tell which.
Assignee: joki → jst
Component: DOM Events → DOM HTML
QA Contact: vladimire → stummala
Douglas, are you appending these radio buttons to a form?  What is "parent"?

Do you happen to have a complete testcase that reproduces the problem?  (I can
try to create one if not....)
Douglas:
  > Douglas, are you appending these radio buttons to a form?  What is
  > "parent"?

  It could be a form, although it should work with any container,
  including document.body.

  > Do you happen to have a complete testcase that reproduces the
  > problem?  (I can try to create one if not....)

  I do, but it depends heavily on the rest of my application.

me:
  > It could be a form, although it should work with any container,
  > including document.body.

  That's not true.  If the radio buttons are not in the same form, they
  don't need to be tied together with NAME.  In particular, radio
  buttons in _different_ forms had better not be tied together.

  Hence it's critical to know whether the buttons are being added as
  children of a form or some descendant of a form.

  > I do, but it depends heavily on the rest of my application.

  Alright.  I'll try to come up with reduced testcases tomorrow, most
  likely...

Douglas:
  > Hence it's critical to know whether the buttons are being added as
  > children of a form or some descendant of a form.

  They are not in a form. I am using the radio buttons as UI elements,
  not as form elements.

me:
  > They are not in a form. I am using the radio buttons as UI elements,
  > not as form elements.

  You still need to have a form around them if you want them to group
  correctly.  Otherwise, how are we to know when you actually want
  grouping and when you do not?

Duplicate of '[RBTN]<input type="radio"> not mutually exclusive without form'

*** This bug has been marked as a duplicate of 14445 ***
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
verified as dup of 14445
Status: RESOLVED → VERIFIED
Component: DOM: HTML → DOM: Core & HTML
QA Contact: stummala → general
You need to log in before you can comment on or make changes to this bug.