tags:

views:

132

answers:

3

in the yii framework

what is the difference between radioButtonList and activeRadioButtonList?

A: 

radioButtonList not related to model activeRadioButtonList related to model

+2  A: 

In Yii there is a "regular" and "active" version of (almost?) every CHtml form field helper/widget. With the "active" version you pass in the ActiveRecord Model and the Attribute you want to make a form field for. This ties the ActiveRecord model more closely to the form field which helps with a few things like:

  1. applying the model->attribute's validation rules (especially ajax validation)
  2. building the proper form $_POST structure for model->attribute assignments
  3. getting the proper field label
  4. etc

Use activeRadioButtonList if you are building a form for an ActiveRecord model, and use radioButtonList if you are building a regular form (for a CFormModel model).

Read more about the both versions of the radioButtonList helper here:

  1. http://www.yiiframework.com/doc/api/CHtml#activeRadioButtonList-detail
  2. http://www.yiiframework.com/doc/api/CHtml#radioButtonList-detail
thaddeusmt
A: 

My dear friend.. Yii give us great functionality AR (ActiveRecord) we can use it by using CRUD method.. for handle AR records(Which can generated by CRUD).. and we can also use own data and record (Without CRUD--AR).. activeRadioButtonList---AR(CRUD).. radioButtonList--(Without CRUD or AR)..

-Regard, -Bhavik Chauhan.

Bhavik Chauhan