등록 페이지의 yii 양식 필드는 두 번 렌더링됩니다 !! 누구든지이 문제를 일으키는 원인을 찾을 수 있도록 도와 줄 수 있습니까?Yii 양식 필드가 두 번 렌더링됩니다.
<?php $pagetitle = "Hubylon | Register"; ?>
<?php $this->breadcrumbs=array('Register'); ?>
<div class="yiiForm">
<?php echo CHtml::beginForm(); ?>
<?php echo CHtml::errorSummary($form); ?>
<div class="row">
<table>
<tr>
<td>*<?php echo CHtml::activeLabel($form,'username'); ?>:</td>
<td><?php echo CHtml::activeTextField($form,'username'); ?></td>
<td><?php echo CHtml::error($form,'username',array('style' => 'color:red;font-size:11px;')); ?></td>
</tr>
</table>
</div>
<div class="row">
<table>
<tr>
<td>*<?php echo CHtml::activeLabel($form,'password'); ?>:</td>
<td><?php echo CHtml::activePasswordField($form,'password'); ?></td>
<td><?php echo CHtml::error($form,'password',array('style' => 'color:red;font-size:11px;')); ?></td>
</tr>
</table>
</div>
<div class="row">
<table>
<tr>
<td>*<?php echo CHtml::activeLabel($form,'confirmPassword'); ?>:</td>
<td><?php echo CHtml::activePasswordField($form,'confirmPassword'); ?></td>
<td><?php echo CHtml::error($form,'confirmPassword',array('style' => 'color:red;font-size:11px;')); ?></td>
</tr>
</table>
</div>
<div class="row">
<table>
<tr>
<td><?php echo CHtml::activeLabel($form,'first_name'); ?>:</td>
<td><?php echo CHtml::activeTextField($form,'first_name'); ?></td>
<td><?php echo CHtml::error($form,'first_name',array('style' => 'color:red;font-size:11px;')); ?></td>
</tr>
</table>
</div>
<div class="row">
<table>
<tr>
<td><?php echo CHtml::activeLabel($form,'birthdate'); ?>:</td>
<td><?php
$this->widget('zii.widgets.jui.CJuiDatePicker', array(
'attribute'=>'birthdate',
'model' => $form,
//'language'=>Yii::app()->language=='en' ? 'en' : null,
'options'=>array(
'dateFormat'=>'yy-mm-dd',
'defaultDate'=>$form->birthdate,
'buttonImage'=>Yii::app()->baseUrl.'/images/icons.date.png',
'buttomImageOnly'=>true,
'showAnim'=>'fold',
'showOn'=>'button',
'yearRange'=>'1900',),
'htmlOptions'=>array(
'style'=>'width:80px;vertical-align:top'
),
));
?></td>
</tr>
</table>
</div>
<div class="action">
<?php echo CHtml::submitButton('Register'); ?>
</div>
<?php echo CHtml::endForm(); ?>
감사 : 여기에 뷰에서 코드가
public function actionRegister()
{
$form=new Users;
// collect user input data
if(isset($_POST['Users']))
{
$form->attributes=$_POST['Users']; // set all attributes with post
// NOTE Changes to any $form->value have to be performed BEFORE $form-validate()
// or else it won't save to the database.
// validate user input and redirect to previous page if valid
if($form->validate())
{
// save user registration
$form->save();
$this->redirect(Yii::app()->createUrl('site/login'));
}
}
// display the registration form
$this->render('register',array('form'=>$form));
}
:
여기 컨트롤러의 코드입니다!
"두 번 표시"하면 동일한보기가로드 된 다음 자동 새로 고침을 의미합니까? –
코드의 abouts가 반복되는 곳은 말 그대로 하나가되고, 두 형식 사이에 다른 html 출력이 있습니까? – Stu
no. 보기가 한 번로드되지만 모든 양식의 필드가 표시되고 바로 아래에 다시 표시됩니다. – avital