Yii - difference between radioButtonList and activeRadioButtonList

in yii structure

What is the difference between radioButtonList and activeRadioButtonList?

+4
source share
2 answers

In Yii, there is a "regular" and "active" version (almost?) Of each helper / widget of the CHtml field. With the "active" version, you pass to the ActiveRecord Model the attribute for which you want to create a form field. This more closely links the ActiveRecord model to the form field, which helps with a few things, such as:

  • applying model-> attribute validation rules (especially ajax validation)
  • creating the correct form of the $ _POST structure for assigning model-> attributes
  • getting the appropriate field label
  • etc.

Use activeRadioButtonList if you are creating a form for the ActiveRecord model and use radioButtonList if you are creating the correct form (for the CFormModel model).

Learn more about both versions of the radioButtonList helper:

+15
source

radioButtonList not associated with the activeRadioButtonList model associated with the model

+3
source

Source: https://habr.com/ru/post/1316495/


All Articles