Visit Mozilla.org

XUL:radiogroup

From MDC

« XUL Reference home    [ Examples | Attributes | Properties | Methods | Related ]

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 for the group. The radiogroup defaults to vertical orientation.

More information is available in the XUL tutorial.

Attributes
disabled, focused, preference, tabindex, value
Properties
accessibleType, disabled, focusedItem, itemCount, selectedIndex, selectedItem, tabIndex, value
Methods
appendItem, checkAdjacentElement, getIndexOfItem, getItemAtIndex, insertItemAt, removeItemAt

[edit] Examples

Image:XUL_ref_radios.png
<radiogroup>
  <radio id="orange" label="Red"/>
  <radio id="violet" label="Green" selected="true"/>
  <radio id="yellow" label="Blue"/>
</radiogroup>

[edit] 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, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top, uri, wait-cursor, width

disabled
Type: boolean
Indicates whether the element is disabled or not. If this element is set to true the element is disabled. Disabled elements are usually drawn with grayed-out text. If the element is disabled, it does not respond to user actions, it cannot be focused, and the command event will not fire.

focused
Type: boolean
This attribute is true if the element is focused.

preference
Type: element id
Connects the element 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 element.

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 sequence.

value
Type: string
The string attribute allows you to associate a data value with an element. It is not used for any specific purpose, but you can access it with a script for your own use.

[edit] Properties

Inherited from XUL element
align, allowEvents, boxObject, builder, className, collapsed, contextMenu, controllers, currentItem, database, datasources, dir, flex, height, hidden, id, left, listBoxObject, maxHeight, maxWidth, menu, minHeight, minWidth, observes, ordinal, orient, pack, persist, ref, resource, statusText, style, tooltip, tooltipText, top, value, width

Inherited from DOM element
attributes, childNodes, cloneNode, firstChild, lastChild, localName, namespaceURI, nextSibling, nodeName, nodeType, nodeValue, ownerDocument, parentNode, prefix, previousSibling, tagName

accessibleType
Type: integer
A value indicating the type of accessibility object for the element.

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 item. You can change the focused item by setting this property.

itemCount New in Firefox 3
Type: integer
Read only property holding the number of child items.

selectedIndex
Type: integer
Returns the index of the currently selected item. You may select an item by assigning its index to this property. By assigning -1 to this property, all items will be deselected.

selectedItem
Type: element
Holds the currently selected item. If no item is currently selected, this value will be null. You can select an item by setting this value. A select event will be sent to the element when it is changed either via this property, the selectedIndex property, or changed by the user.

tabIndex
Type: integer
Gets and sets the value of the tabindex attribute.

value
Type: string
Gets and sets the value of the value attribute.

[edit] Methods

Inherited from XUL element
blur, click, doCommand, focus, getElementsByAttribute

Inherited from DOM element
addEventListener, appendChild, dispatchEvent, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, hasAttribute, hasAttributeNS, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, removeEventListener, replaceChild, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS

appendItem( label, value )
Return type: element
Creates a new item and adds it to the end of the existing list of items. You may optionally set a value. The function returns the newly created element.

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.

getIndexOfItem( item )
Return type: integer
Returns the zero-based position of the specified item. Items are numbered starting at the first item displayed in the list.

getItemAtIndex( index )
Return type: element
Returns the element that is at the specified index.

insertItemAt( index, label, value )
Return type: element
This method creates a new item and inserts it at the specified position. You may optionally set a value. The new item element is returned.

removeItemAt( index )
Return type: element
Removes the child item in the element at the specified index. The method returns the removed item.

[edit] Related

Interfaces
nsIAccessibleProvider, nsIDOMXULSelectControlElement