Hi
I have a text box in which user will be able to enter text and when I click the "OK" then the user entered input should be stored in DB. How to accomplish this?
[size="7"][font="Arial Black"]View:[/font][/size]
‘Delete’=>array(
'label'=>'Delete',
'url'=>'CController::createUrl("/prf/deleteRecord", array("prfnumber"=>$data->prf_number))',
'visible'=>'(Yii::app()->user->type == 6 AND $data->nacknowledged==4) OR Yii::app()->user->type == 1 ',
'click'=>'function(){deleteUrl = $(this).attr("href");$("#deleteDialog").dialog("open"); return false;}',
),
),
),
));
$this->beginWidget(‘zii.widgets.jui.CJuiDialog’,array(
'id'=>'deleteDialog',
'options'=>array(
'title'=>'Delete Reason',
'autoOpen'=>false,
'modal'=>true,
'closeOnEscape'=>true,
'buttons' => array(
array('text'=>'Ok','click'=>'js:function(){deleteUrl = deleteUrl+"&message="+$("#message").text(); window.location.href = deleteUrl;}','onclick' =>'Save()'),
array('text'=>'Cancel','click'=> 'js:function(){$(this).dialog("close");}'),
),
'width'=>'350',
'height'=>'200',
'show'=>array('effect'=>'fold','duration'=>100),
),
));
echo ‘<form id=“frmDelete” method=“GET”>’;
echo ‘<span>comments</span><br/>’;
echo CHtml::textArea('message'); // this generate the textArea
echo ‘</form>’;
$this->endWidget(‘zii.widgets.jui.CJuiDialog’);
[size="7"][font="Arial Black"]Controller[/font][/size]
public function actionDeleteRecord()
{
$modelPrf = $this->loadModel($_GET['prfnumber']);
$modelAnn = Annletter::model()->findAll('prfnumber=:prfnumber',array('prfnumber'=>$_GET['prfnumber']));
$modelClaim = ClaimAmount::model()->findAll('prf=:prf',array('prf'=>$_GET['prfnumber']));
//Copy Delete into Register
$modelDelete = new Prfdeleted() ;
$modelDelete->attributes = $modelPrf->attributes;
$modelDelete->prf_startdate = date('Y-m-d',strtotime($modelPrf->prf_startdate));
$modelDelete->deletedBy = Yii::app()->user->name;
$modelDelete->deletedTime = date('Y-m-d H:m:s');
$modelDelete->save();
if ($modelAnn != null )
{
$count = count($modelClaim);
for ($i=0;$i<$count;$i++)
{
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelAnn[$i]->prfnumber,Users::getBPEmail($modelAnn[$i]->bpname,$modelAnn[$i]->segment ));
$modelAnn[$i]->delete();
$modelClaim[$i]->delete();
}
//Send Email to BP and Internal
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'2',$modelPrf->segment));
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'3',$modelPrf->segment));
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'4',$modelPrf->segment));
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'6',$modelPrf->segment));
$modelPrf->delete();
}
else
{
//Send Email to Internal Only
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'2',$modelPrf->segment));
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'3',$modelPrf->segment));
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'4',$modelPrf->segment));
Annletter::sendEmail('emailIntDeleteRecord',array('modelPrf'=>$modelPrf),'PROGRAM REVOKED-'.$modelPrf->prf_number,Users::getEmail($modelPrf->bp_country,'6',$modelPrf->segment));
$modelPrf->delete();
}
$this->redirect('activeCam');
}