radio()

Create radio button. The form's controls will be buffered and displayed upon calling the display() method.

string radio( string field, array values [, mixed default [, bool valid = true [, int usage = 1 [, string value ]]]])

Return

Buffers and returns HTML code.

Parameter
Description
fieldInput field name
valuesDefine radio button options: array(key => name)
defaultDefault key value as defined in values parameter. The default value will be used if the form has not been sent.
validExpression that results in TRUE/FALSE
usage0=store
1=require+store
2=require
valueManually overwrite or reset the control's value (even if the form has been sent!)

Create radio buttons

$FORM->radio("testfield", array(1 => "One", 2 => "Two", 3 => "Three"))
RETURN: '<div id="frm_testform_outer_testfield" class="frm_testform div_outer div_radio testfield"> <div class="set_radio testfield testfield1 value1"><input type="radio" class="opt_input testfield1" name="testfield" id="frm_testform_testfield_1" value="1" ...

Create radio buttons, set default value

$FORM->radio("option2", array("opt1" => "One", "opt2" => "Two"), "opt2")
RETURN: '<div id="frm_testform_outer_option2" class="frm_testform div_outer div_radio option2"> <div class="set_radio option2 option2opt1 valueopt1"><input type="radio" class="opt_input option2opt1" name="option2" id="frm_testform_option2_opt1" value="opt1" ...