Monday, March 30, 2009

cakephp radio button (form helper)

Using $form->radio(string $fieldName, array $options, array $attributes)

Creates a radio button input. Use $attributes['value'] to set which value should be selected default.

Use $attributes['separator'] to specify HTML in between radio buttons (e.g. <br />).

Radio elements are wrapped with a label and fieldset by default. Set $attributes['legend'] to false to remove them.

EXAMPLE 1 :

$form->radio('login_type', array('1' => 'Login Name', '2' => 'Email'), null,array())

Using $form->input(string $fieldName, array $options = array())

EXAMPLE 2 :
echo $form->input('Options.selectPlan', array(
     'div' => false,
     'label' => true,
     'type' => 'radio',
     'options' => array(1 => 'Plan 1', 2 => 'Plan 2')
);



--
Regards,

Pavan Kumar P G
Software Engineer
Informedia Technologies (M) Pvt Ltd.
Mysore.