Codxplore.com

Latest news: New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!


in top of your model import array helper class use yii\helpers\ArrayHelper; in the model section we can populate the data this way. public function getServices()     {         $model = Services::find()->all();         $listData=ArrayHelper::map($model,'service_id','name_en');         return $listData;     } in the view section we need to use like that

Views: 3834


findBySql(); $sql = 'Select * from tbl_country'; $country = Country::findBySql($sql)->all();

Views: 1046


Sample 1: Category::find()->where(['category_id' => "1", 'parent_id' => "0"])->one(); Sample 2: Products::find()->asArray()->where('price between ' . $min . ' and ' . $max . ' ')->all(); Sample 3: Users::find()->where('email=' . $email)->all();

Views: 674


Using below code we can create the list box base on model attribute of yii2.0 framework. We added the following options like prompt, size, disabled, style etc

Views: 1108


Single File Upload MultiFile Upload Checkbox Button Field    

Views: 887


HTML5 Email Input Field

Views: 745


Password Input Field //Format 1 //Format 2 //Format 3

Views: 593


Text Input Field //Format 1 //Format 2

Views: 780


TextArea Field :   The model attribute value shal be used as the content in the textarea.  

Views: 974


Form code :  $form = $this->beginWidget('CActiveForm', array(                         'id' => 'aa--aprvl--setup-_form-form',                         // Please note: When you enable ajax validation, make sure the corresponding                         // controller action is handling ajax validation correctly.                &nb....

Views: 775


We can use this piece of code for jQuery ui date picker in php Yii framework. here, model = is your model class attribute = model attribute / table column name option = contains date picker formate, animation type etc htmlOptions = contains the id , class etc   thanks  

Views: 540


Add your own defined method in your model class .For Example public function getMacList() {         $model = POS_MAC::model()->findAll();         $data = CHtml::listData($model, 'MID', 'MAC_ADDRESS');                  return $data; }   and your html where you want to view the data into select box     here, 1st parameter is your model ,  2nd parameter is database column name or model attribute name 3rd parameter is the method which is defined in your model class 4rth parameter is html option . eg (class,id,.....)   thanks

Views: 545

Subscribe Us


Follow Us