Hi All,
I have a model(table with 2 fields name(pk) and text). I need to show the data in these forms and update it from the page.
I’m able to show the form by using this
<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
but how to show the content from the table into each section and how to update the data.
index.php is like this:
<p>some & Text</p>
<p>
<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
</p>
<p>Some more Text</p>
<p>
<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
</p>
<p>Little More Text</p>
<p>
<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
</p>
my _form.php is like this:
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'settings-form',
'enableAjaxValidation'=>false,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model,'name'); ?>
<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>255)); ?>
<?php echo $form->error($model,'name'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'text'); ?>
<?php echo $form->textArea($model,'text',array('rows'=>6, 'cols'=>50)); ?>
<?php echo $form->error($model,'text'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Submit' : 'Save'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
What should be my url for the index.php inorder to show the content from the table.(at the moment i’m using localhost/webapp/controller… and its displaying with form 3 times.
Many Thanks in advance