/**
* The required files
*/
require_once(HTML_FORM_COMPONENT_PATH.'/Input.php');
/**
* Generates an INPUT element for a form, which is a Radio control
* <code>
* <input type="radio" name="$name" value="$value" title="$title" tabindex="" disabled="disabled"
* class="$class" checked="$checked" onclick="alert('Hello')" accesskey="$accesskey" />
* Usage:
* $radio = new Radio($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
* print $radio->getHtml();
* Or
* Radio::display($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
* </code>
* Note: If you use the onclick facility, then use double quotes outside, and use single quotes inside
* Example: Radio::display($name,$value,$class,$checked,$disabled,"alert('hei');");
* @package form
*/
class Radio extends Input {
/**
* Constructor
* @param String $name The name
* @param String $value The value, if any
* @param String $class The class
* @param String $checked The checked, if present
* @param String $disabled The disabled
* @param String $onclick On click event for javascript
* @param String $title The tooltip
* @param String $tabindex The tabindex
* @param String $accesskey The accesskey
*/
function Radio($name,$value='',$class='',$checked='',$disabled='',$onclick='',$title='',$tabindex='',$accesskey='') {
$aClass = $class!=''?$class:CSS_RADIO_CLASS;
$size = $checked; // Use the size as a placeholder for the checked attribute
$maxlength = ''; // Not supported
$readonly = ''; // Not supported
$aValue = $value!=''?$value:'';
if ($aValue=='' && $onclick!='') {
$aValue = 'notUsed';
}
$this->Input('radio',$name,$aValue,$aClass,$size,$maxlength,$disabled,$readonly,$onclick,$title,$tabindex,$accesskey);
}
/**
* Display html
* <code>
* Usage:
* Radio::display($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
* </code>
* @static
* @param String $name The name
* @param String $value The value, if any
* @param String $class The class
* @param String $checked The checked, if present
* @param String $disabled The disabled
* @param String $onclick On click event for javascript
* @param String $title The tooltip
* @param String $tabindex The tabindex
* @param String $accesskey The accesskey
*/
function display($name='',$value='',$class='',$checked='',$disabled='',$onclick='',$title='',$tabindex='',$accesskey='') {
$html = new Radio($name,$value,$class,$checked,$disabled,$onclick,$title,$tabindex,$accesskey);
$html->addHtml();
}
}
?>