Hi I am new to YII.
I have added new table field "specifications" in the database and make following changes but value for this field not saving and updating from FORMS. I have delete all files from RUNTIME folder but problem not solved.
Model Changes:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('ptype, name', 'required'),
array('ptype, status', 'numerical', 'integerOnly'=>true),
array('name', 'length', 'max'=>50),
array('description', 'length', 'max'=>200),
array('user_id', 'length', 'max'=>20),
array('edt', 'safe'),
// The following rule is used by search().
// @todo Please remove those attributes that should not be searched.
array('id, ptype, name, specifications, description', 'safe', 'on'=>'search'),
);
}
public function attributeLabels()
{
return array(
'id' => 'ID',
'ptype' => 'Product Type',
'name' => 'Name',
'specifications' => 'Specification',
'description' => 'Description',
'user_id' => 'User',
'status' => 'Status',
'sdt' => 'Sdt',
'edt' => 'Edt',
);
}
View Changes:
$this->widget(‘bootstrap.widgets.TbGridView’, array(
'type'=>'striped bordered condensed',
'dataProvider'=>$model->search(),
'template'=>"{items}",
'filter'=>$model,
'columns'=>array(
array('name'=>'id', 'header'=>'Product ID'),
array('name'=>'name', 'header'=>'Name'),
array('name'=>'specifications'),
//array('name'=>'PT.product_type', 'header'=>'Type'),
array('name'=>'ptype', //'header'=>'Type',
'value'=>'ProductType::model()->findByPk($data->ptype)->product_type'
),
array(
'class'=>'bootstrap.widgets.TbButtonColumn',
'htmlOptions'=>array('style'=>'width: 50px'),
),
),
));