public
Description: JavaScript Application Framework - JS library only
Home | Edit | New

Radio_group_view

A Radio Group VIew is a view helper to set up a group of radio buttons and have them bound to one property of a controller.


<%= radio_group_view 
    :name_of_group
    :values => [[value_one, 'Text1'],[value_two, 'Text2]],
    :layout => :horizontal/:vertical,
    :bind => {
        :value => 'MyApp.Controller.property'
    }
%>
  • name_of_group :: The name of the group
  • values :: An array of values and texts. The value represents the actual value of the property, the text is used as label with the radio button of that value. The text can be a localisation string, in which case ‘Text1’ should be replaced by loc('_loc_string')
  • layout :: Parameter for the orientation of the group.

An example of radio button group for Yes / No options:


//In this example, 1 is used for true and 0 for false. 
//You can of course also use true or false itself.

<%= radio_group_view 
    :values => [[1, 'Yes'], [0, 'No']], 
    :layout => :horizontal,
    :bind => {
           :value => 'YourApplication.detailController.active' 
    } 
%>

Comments

Last edited by mauritslamers, Mon Sep 29 03:49:07 -0700 2008
Home | Edit | New
Versions: