Jump to content

Field_values with rodiobutton


Recommended Posts

Hello everybody,

 

I try hard to preselect a radiobutton or a select element in my form.

 

My form looks ok and does well, but i want to add a bunch of radiobutton or a select and non work.

                array(
                    'type' => 'radio',
                    'label' => 'Deactivate',
                    'name' => 'EXCLUDE',
                    'values' => array(      
                        array(
                            'id' => 'exclude_on',
                            'value' => 1,
                            'label' => 'Yes'
                        ),
                        array(
                            'id' => 'exclude_off',
                            'value' => 0,
                            'label' => 'No'
                        )
                    ),
                    'required' => true,
                    'is_bool' => true,
                ),
                array(
                    'type' => 'radio',
                    'label' => 'Status',
                    'name' => 'ONLINE',
                    'values' => array(    
                        array(
                            'id' => 'online_test',
                            'value' => 'test',
                            'label' => 'Test'
                        ),
                        array(
                            'id' => 'online_on',
                            'value' => 'online',
                            'label' => 'Online'
                        ),
                        array(
                            'id' => 'online_off',
                            'value' => 'offline',
                            'label' => 'Offline'
                        )

                    ),
                    'required' => true,
                    'is_bool' => false,
                ),

and i want to have preselect to be able to modify my choices.
 I didn't find anything usefull in the modules .

The first one work well because it's a boolean i think.

        $helper->fields_value['EXCLUDE'] = 0; /// work well

        $helper->fields_value['ONLINE'] -> values['online'] = true; // one of the numerous trys i did

I think i have to loop upon the various value but don't know what to aim at !

 

Thanks a lot if you try to help me :)

Edited by ChtiWaz (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...