yiiwidgetyii-cform

How to use widget by Yii CFrom


I have a CForm which is instantiate in a controller. Now I need to use some widgets as its element, even by validations and more capabilities. Who to do that?


Solution

  • Validations are something that belong into the realm of the injected model. It is not the duty of CFormto perform any input validation/sanitization.

    As for widgets, see this part of the guide. Just before the section "Specifying Static Text," there is a whole bunch of informations on how to integrate widgets extending either CInputWidget or CJuiInputWIdget.