Answer the question
In order to leave comments, you need to log in
How to update all rows by attributes in Yii1.1?
Please tell me how to implement correctly. I have a model, I rake out all the lines from it by the 'phone = 1' attribute.
Now I want to display all these 'phone' inputs in the view in a column, with the ability to change them. I am doing like this
Controller Action:
<?php
class HomeController extends Controller
{
public function actionIndex()
{
$model = Post1::model()->findAllByAttributes(array('phone' => array(1)));
$this->render('index', array(
'model'=>$model,
));
}
<?php
/* @var $this HomeController */
?>
<?php $form = $this->beginWidget('CActiveForm', array(
'id'=>'user-form',
'enableAjaxValidation'=>true,
'enableClientValidation'=>true,
'focus'=>array($model,'firstName'),
)); ?>
<?php echo $form->errorSummary($model); ?>
<?php foreach ($model as $one){?>
<div class="row">
<?php echo $form->labelEx($one,'name'); ?>
<?php echo $form->textField($one,'name'); ?>
<?php echo $form->error($one,'name'); ?>
<?php }?>
<div class="row buttons">
<?php echo CHtml::submitButton('Сохранить'); ?>
</div>
<?php $this->endWidget(); ?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question