public function rules()
{
array('about_open', 'required'),
array('about_open', 'my_required'),
}
public function my_required($attribute_name, $params){
if($this->about_open==6 && $this->other2==''){
$this->addError('other2',
'Please Pleae fill other field');
}
else if($this->about_open==5 && $this->other1==''){
$this->addError('other1','Please Pleae fill other field');
}
}
Wednesday, November 20, 2013
yii Custom Function Validation
Sunday, November 17, 2013
Yii radioButtonList template....
$arrayvalue = array('1'=>'I heard about it from a friend', '2'=>'I found it on-line', '3'=>'I received an invitation from Tindercapital', '4'=>'I received an invitation from DRIK RVJN', '5'=>'
I received an invitation from another organisation (Please specify) :', '6'=>'
Others (Please specify)');
echo $form->radioButtonList($model,'about_open',$arrayvalue,
array( 'separator'=>' ', 'template'=>"Friday, November 15, 2013
yii multiple table with multiple column search
$criteria = new CDbCriteria;
$criteria->compare('fullname',$_GET['User']['keyword'],true,'OR'); // $_GET['User']['keyword'] search field name
$criteria->compare('email',$_GET['User']['keyword'],true,'OR');
$criteria->compare('phone',$_GET['User']['keyword'],true,'OR');
$criteria->compare('presentaddress',$_GET['User']['keyword'],true,'OR');
$criteria->compare('profession',$_GET['User']['keyword'],true,'OR');
$criteria->with = array('homedistrict0','bloodgroup0','upozila0'); // Relation name
$criteria->compare('homedistrict0.name',$_GET['User']['keyword'],true,'OR');
$criteria->compare('upozila0.name',$_GET['User']['keyword'],true,'OR');
$criteria->compare('bloodgroup0.name',$_GET['User']['keyword'],true,'OR');
$criteria->together = true;
Subscribe to:
Comments (Atom)