Fatal error: a member function getAttributeLabel()
#1
Posted 09 December 2010 - 04:17 AM
I could not get any idea, so I need your help.
#2
Posted 09 December 2010 - 04:27 AM
Post here full stack trace.. or the some code that you added before the error appeared...
---
From the error line I see that this is a call to activeLabel()
#3
Posted 09 December 2010 - 04:47 AM
mdomba, on 09 December 2010 - 04:27 AM, said:
Post here full stack trace.. or the some code that you added before the error appeared...
---
From the error line I see that this is a call to activeLabel()
File location: mySiteName/protected/views/site/index.php Here I wanted to put those forms. The code is listed below:
<?php $this->pageTitle=Yii::app()->name; ?>
<p style="width:200px; float:left; font-family:fantasy; font-size:12px; color:"><?php echo CHtml::encode(Yii::app()->name); ?> helps you connect and share with the people in your life.</p>
<div class="registrationform">
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'login-form',
'enableAjaxValidation'=>true,
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username'); ?>
<?php echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password'); ?>
<?php echo $form->error($model,'password'); ?>
<p class="hint">
Hint: You may login with <tt>demo/demo</tt> or <tt>admin/admin</tt>.
</p>
</div>
<div class="row rememberMe">
<?php echo $form->checkBox($model,'rememberMe'); ?>
<?php echo $form->label($model,'rememberMe'); ?>
<?php echo $form->error($model,'rememberMe'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton('Login'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
</div>
#4
Posted 09 December 2010 - 04:57 AM
#6
Posted 09 December 2010 - 05:18 AM
The code
$form->labelEx($model,'username');
Renders an HTML label for a model attribute in this case $model->username.
#7
Posted 09 December 2010 - 05:34 AM
mdomba, on 09 December 2010 - 05:18 AM, said:
The code
$form->labelEx($model,'username');
Renders an HTML label for a model attribute in this case $model->username.
But as there is already LoginForm.php (protected/models/LoginForm.php). It should work , shouldn't it?
I tried to echo the value of $model; but it returns null (nothing).
#8
Posted 09 December 2010 - 05:42 AM
The actionLogin() in SiteController.php creates a new instance of that model and renders the view with this line
$this->render('login',array('model'=>$model));So that in the view - index.php $model is an instance of the model LoginForm...
Hope you understant this...
Try to study the default code generated by yiic... and if you haven't done so... read the Definitive guide to Yii
if you need help... just ask...
#9
Posted 09 December 2010 - 05:46 AM
mdomba, on 09 December 2010 - 05:42 AM, said:
The actionLogin() in SiteController.php creates a new instance of that model and renders the view with this line
$this->render('login',array('model'=>$model));So that in the view - index.php $model is an instance of the model LoginForm...
Hope you understant this...
Try to study the default code generated by yiic... and if you haven't done so... read the Definitive guide to Yii
if you need help... just ask...
Thank you mdomba for your kind support. I will try once and if get prob. I will seek your help. Thanks again.
#10
Posted 09 December 2010 - 06:48 AM
This forum is for reporting bugs.
Not in your own code, though.
#11
Posted 31 January 2013 - 06:44 AM

Help














