php - YII: Radiobuttons On Action Should Update The Text Field -
i want create 2 buttons in _form.php
.
the 2 buttons '0'=>approve
, '1'=>reject
.
now, have 2 text fields date
, modified by
. need update date
current date , modify by
login
name when approve
clicked , need update date
null
, modify by
login
name when reject clicked.
how can this?
no need create textfield
modifiedby
or date
.
check button pressed in controller. , whatever action want take. this:
if(isset($_post['post']['approve'])===true){ $this->date = new cdbexpression('now()'); $model->save(); } if(isset($_post['post']['reject'])===true){ $this->date = ''; $model->save(); }
adding rule
in model, lets add name on insert
or update
.
array('modifiedby','default','value'=>yii::app()->user->title,'setonempty'=>false,'on'=>'update'), array('modifiedby','default','value'=>yii::app()->user->title,'setonempty'=>false,'on'=>'insert')
Comments
Post a Comment