Home > Element Reference : Radiogroup

Contents

### Radiogroup

A group of radio buttons. Only one radio button inside the group can be selected at a time. The radio buttons may either direct children of the radiogroup or descendants. Place the radiogroup inside a groupbox if you would like a border or caption around the group. The radiogroup defaults to vertical orientation.

To set the radio button that will be selected by default, set the selected attribute of a child radio element.

More information about radiogroup

The radiogroup element implements the following interfaces:

nsIAccessibleProvider nsIDOMXULSelectControlElement

Attributes:

disabled | focused | preference | tabindex | value

Properties and Methods:

accessible | appendItem | checkAdjacentElement | disabled | focusedItem
insertItemAt | removeItemAt | selectedIndex | selectedItem | tabIndex
value

#### Attributes:

Inherited from XUL Element:

align
allowevents
allownegativeassertions
class
coalesceduplicatearcs
collapsed
container
containment
context
contextmenu
datasources
dir
empty
equalsize
flags
flex
height
hidden
id
insertafter
insertbefore
left
maxheight
maxwidth
menu
minheight
minwidth
mousethrough
observes
ordinal
orient
pack
persist
popup
position
preference-editable
ref
removeelement
sortDirection
sortResource
sortResource2
statustext
style
template
tooltip
tooltiptext
top
uri
wait-cursor
width

##### disabled

Type: boolean

Indicates whether the radiogroup is disabled or not. If this attribute is set to true, the radiogroup is disabled. This is usually drawn with the text in grey. If the radiogroup is disabled, it does not respond to user actions. The element cannot be focused and the command event will not fire. The element will still respond to mouse events. To enable the radiogroup, leave the attribute out entirely as opposed to setting the value to false.

##### focused

Type: boolean

This attribute is set to true if the radiogroup element is focused.

##### preference Mozilla 1.8

Type: element id

Connects the radiogroup to a corresponding preference. This attribute only has any effect when used inside a prefwindow. The value of the preference will be updated to match the value property of the radiogroup.

##### tabindex

Type: integer

The tab order of the element. The tab order is the order in which the focus is moved when the user presses the Tab key. Elements with a higher tabindex are later in the tab order sequence.

##### value

Type: string

Returns the value property of the currently selected radio button. To change the selection, use the selectedIndex or selectedItem property.

#### Properties and Methods:

Inherited from XUL Element:

align
allowEvents
blur
boxObject
boxObject.element
boxObject.getLookAndFeelMetric
boxObject.height
boxObject.screenX
boxObject.screenY
boxObject.width
boxObject.x
boxObject.y
builder
className
click
collapsed
contextMenu
controllers
database
datasources
dir
doCommand
flex
focus
getElementsByAttribute
height
hidden
id
left
maxHeight
maxWidth
menu
minHeight
minWidth
observes
ordinal
orient
pack
persist
ref
resource
statusText
style
tooltip
tooltipText
top
width

Inherited from Element:

addEventListener
appendChild
attributes
childNodes
cloneNode
dispatchEvent
firstChild
getAttribute
getAttributeNS
getAttributeNode
getAttributeNodeNS
getElementsByTagName
getElementsByTagNameNS
hasAttribute
hasAttributeNS
hasAttributes
hasChildNodes
insertBefore
isSupported
lastChild
localName
namespaceURI
nextSibling
nodeName
nodeType
nodeValue
normalize
ownerDocument
parentNode
prefix
previousSibling
removeAttribute
removeAttributeNS
removeAttributeNode
removeChild
removeEventListener
replaceChild
setAttribute
setAttributeNS
setAttributeNode
setAttributeNodeNS
tagName

##### accessible

Type: nsIAccessible

Returns the accessibility object for the radiogroup.

##### appendItem ( label , value )

Return Type: radio element

Creates a new radio element and adds it to the end of the radiogroup. You may optionally set a value. The function returns the new item.

##### checkAdjacentElement ( dir )

Return Type: no return value

Deselects the currently selected radio button in the group and selects the one adjacent to it. If the argument dir is true, the next radio button is selected. If it is false, the previous radio button is selected.

##### disabled

Type: boolean

Gets and sets the value of the disabled attribute.

##### focusedItem

Type: radio element

Holds the currently focused item in the radiogroup, which may or may not be the same as the selected one. You can change the focused item by setting this property.

##### insertItemAt ( index, label , value )

Return Type: radio element

Creates a new radio element and inserts it at a specific position in the radiogroup. You may optionally set a value. The function returns the new item.

##### removeItemAt ( index )

Return Type: radio element

Removes the child item in the radiogroup at the given index. The function returns the removed item.

##### selectedIndex

Type: radio element

Holds the index of the currently selected item in the radiogroup. If no item is currently selected, this value will be set to -1.. You can select an item by setting this value.

##### selectedItem

Type: radio element

Holds the currently selected item in the radiogroup. If no item is currently selected, this value will be null. You can select an item by setting this value. A RadioStateChange event will be sent to the selected radio button when it is changed either via this property, the selectedIndex property, or changed by the user.

##### tabIndex Mozilla 1.8

Type: integer

Get and sets the value of the tabindex attribute.

##### value

Type: string

Gets and sets the value of the value attribute.

Copyright (C) 1999 - 2004 XulPlanet.com