yii-cformmodel

Yii populate a dropdown on select of another

[亡魂溺海] 提交于 2019-12-13 05:07:41
问题 I have a dropdown that I want to populate when an item in another dropdown is selected. Both the dropdown are tied to data/model passed on from controller. and the first dropdown is populated from DB by calling a function in the model. Heres' the form, echo $form->dropDownListRow($modelunit, 'superunit', $model->getSunits(), array( 'ajax' => array( 'type'=>'POST', 'url'=>CController::createUrl('user/getunits'), 'update'=>'#unit_id', ))); echo CHtml::dropDownList('unit_id','', array()); Here's

CModel vs CFormModel vs CActiveRecord

空扰寡人 提交于 2019-12-09 12:58:22
问题 I am building a db intensive application in yii . So performance and security are naturally a concern . Apart from that form validation is also a major criteria . For security I plan to use parameter binding for all Sql Queries . For validation I want to use validators provided by Yii instead of rolling out my own . I am aware that performance takes a hit with CActiveRecord . So I plan to make Cmodel classes for all my tables , define validation rules in these respective models and also