Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 9 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow 11. API Reference arrow mosHTML::radioList

mosHTML::radioList PDF Print E-mail

Last reviewed: Not reviewed
phpDocumentor

mosHTML::radioList

A convenient method of producing a list of HTML radio buttons.

Syntax

string  radioList ( array &$arr, string $tag_name, string $tag_attribs
                                         [, mixed $selected [, string $key [, string $text ]]] )

$arr
is an array of objects that have been returned by a query or the mosHTML::makeOption method.
$tag_name
is the name of the HTML radio button field.
$tag_attribs
is a string containing any additional attributes that you want to assign to each HTML radio button field.
$selected
is a string containing the value of the radio button that will be selected as the default.  This parameter is optional and if absent none of the radio buttons will be selected by default.
$key
is the name of the class variable holding the option 'value'.  Should generally be 'value' and will default to this if this parameter is omitted.
$text
is the name of the class variable holding the option 'text'.  Should generally be 'text' and will default to this if this parameter is omitted.

Examples

Example:

// Create an array of options.
$mylist = array();
$mylist[] = mosHTML::makeOption( 'Radio 1' );
$mylist[] = mosHTML::makeOption( 'Radio 2' );
$mylist[] = mosHTML::makeOption( 'Radio 3' );
 
// Generate the HTML radio button list.
$html = mosHTML::radioList( $mylist, 'chan', 'class="inputbox"', 'Radio 2' );
echo $html;

which produces:

<input type="radio" name="chan" id="chanRadio 1" value="Radio 1" class="inputbox" />
<label for="chanRadio 1">Radio 1</label>
<input type="radio" name="chan" id="chanRadio 2" value="Radio 2" checked="checked" class="inputbox" />
<label for="chanRadio 2">Radio 2</label>
<input type="radio" name="chan" id="chanRadio 3" value="Radio 3" class="inputbox" />
<label for="chanRadio 3">Radio 3</label>
 

which renders as:

Radio 1 Radio 2 Radio 3

Please report any errors on this page to the Developer Documentation Forum.

Last Updated ( Friday, 23 September 2005 )
 
< Prev   Next >