tags:

views:

786

answers:

1

I am using jQuery and CakePHP for my application.

In my application with the data that I have saved in the database, for example if the Field type column is text then I am generating a text box in my code using $form->input();

If it is a dropdown box, I am generating it using:

echo $form->input($r['Attribute']['label'],
    array('id'=>$r['Attribute']['id'],'name'=>$r['Attribute']['label'],
        'options' => array(1,2,3,4,5)));

Now I have a field of type "Radio button". I am trying to create the radio box in CakePHP. Is it possible... If so how?

+1  A: 

Using FormHelper::input(), you can specify the type of field you want by setting the type option:

echo $form->input($r['Attribute']['label'], array(
    'type' => 'radio',
    'id' => $r['Attribute']['id'],
    'name' => $r['Attribute']['label'],
    'options' => array(1, 2, 3, 4, 5),
));
deizel