function isAttributeRequired() problem on login access

everytime i access the login page [site/login] this error shows up:

Check your login page… could be that you spelled wrong a model in calling activeLabelEx…

oh yeah some letter were in lower case… thanks for that. but i still have a problem… actually it showed up after i fixed the activeLabelEx stuff.

this php error shows up.



Property "CActiveForm.activeLabelEx" is not defined.

Source File


00588:                 array('{class}'=>get_class($this), '{property}'=>$name)));

00589:     }

00590:     public function __call($name,$parameters)

00591:     {

00592:         if($this->_m!==null)

00593:         {

00594:             foreach($this->_m as $object)

00595:             {

00596:                 if($object->getEnabled() && method_exists($object,$name))

00597:                     return call_user_func_array(array($object,$name),$parameters);

00598:             }

00599:         }

00600: if(class_exists('Closure', false) && $this->$name instanceof Closure)

00601:             return call_user_func_array($this->$name, $parameters);

00602:         throw new CException(Yii::t('yii','{class} does not have a method named "{name}".',

00603:             array('{class}'=>get_class($this), '{name}'=>$name)));

00604:     }

00605:     public function asa($behavior)

00606:     {

00607:         return isset($this->_m[$behavior]) ? $this->_m[$behavior] : null;

00608:     }

00609:     public function attachBehaviors($behaviors)

00610:     {

00611:         foreach($behaviors as $name=>$behavior)

00612:             $this->attachBehavior($name,$behavior);

Stack Trace

#0 C:\xampp\yii\framework\yiilite.php(600): CComponent->__get('activeLabelEx')

#1 [internal function]: CComponent->__call('activeLabelEx', Array)

#2 C:\xampp\htdocs\viasatondemand\admin\protected\views\site\index.php(19): CActiveForm->activeLabelEx(NULL, 'username')

#3 C:\xampp\yii\framework\yiilite.php(2851): require('C:\xampp\htdocs...')

#4 C:\xampp\yii\framework\yiilite.php(2830): CBaseController->renderInternal('C:\xampp\htdocs...', NULL, true)

#5 C:\xampp\yii\framework\yiilite.php(3220): CBaseController->renderFile('C:\xampp\htdocs...', NULL, true)

#6 C:\xampp\yii\framework\yiilite.php(3197): CController->renderPartial('index', NULL, true)

#7 C:\xampp\htdocs\viasatondemand\admin\protected\controllers\SiteController.php(28): CController->render('index')

#8 C:\xampp\yii\framework\yiilite.php(3430): SiteController->actionIndex()

#9 C:\xampp\yii\framework\yiilite.php(3002): CInlineAction->run()

#10 C:\xampp\yii\framework\yiilite.php(2987): CController->runAction(Object(CInlineAction))

#11 C:\xampp\yii\framework\yiilite.php(2977): CController->runActionWithFilters(Object(CInlineAction), Array)

#12 C:\xampp\yii\framework\yiilite.php(1542): CController->run('')

#13 C:\xampp\yii\framework\yiilite.php(1434): CWebApplication->runController('')

#14 C:\xampp\yii\framework\yiilite.php(1049): CWebApplication->processRequest()

#15 C:\xampp\htdocs\viasatondemand\admin\index.php(11): CApplication->run()

#16 {main}

this is the whole code in login.php

<?php $this->pageTitle=Yii::app()->name; ?>

<br  /><br  /><center><p><em>Welcome to the Viasatondemand Administration Section.</em></p></center>


<p>Please fill out the following form with your login credentials:</p>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(



)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<div class="row">

		<?php echo $form->activeLabelEx($model,'username'); ?>

		<?php echo $form->textField($model,'username'); ?>

		<?php echo $form->error($model,'username'); ?>


	<div class="row">

		<?php echo $form->activeLabelEx($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>.



	<div class="row rememberMe">

		<?php echo $form->checkBox($model,'rememberMe'); ?>

		<?php echo $form->label($model,'rememberMe'); ?>

		<?php echo $form->error($model,'rememberMe'); ?>


	<div class="row buttons">

		<?php echo CHtml::submitButton('Login'); ?>


<?php $this->endWidget(); ?>

</div><!-- form -->

CActiveForm does not have activeLabelEx but it has labelEx that is a wrapper for activelabelEx -

so use $form->labelEx

oh okay lemme try that… thanks for replying :D

I changed activeLabelEx to labeEx but still that error shows up [again]… sigh

i got it now… i was stupidly trying to fit the active form in the index file my bad -_-… now i really have to find a way to put a log in form in that admin index

thanks for replying… it was a big help :)

Check in SiteController->actionLogin what are you sending as $model when calling render…

should be

$model=new LoginForm;



is this it?.. i can clearly see that it’s $form not $model… and this is the default code inside SiteController

public function actionLogin()


		$form=new LoginForm;

		// collect user input data




			// validate user input and redirect to the admin page is it's a valid login.



				$this->redirect( Yii::app()->homeUrl . 'event/admin' );


		// display the login form



OK… something is wrong here…



you are creating a PHP variable $form that you can use in login.php…

so instead of $model you would be using $form…


on the beginning of the login.php you have

$form=$this->beginWidget('CActiveForm', ...

and with that you loose the value you sent to login.php…

but in this case you would get the error

as $model is not defined anywhere…

as you are not getting that error then $model is defined somewhere :unsure:

yeah weird… freakish weird… sigh… well okay nevermind that… thanks! :D i would like to ask something as a last request… how do i put a login form at your index.php?[view]

T_T i’m so stuck with this.

Why would you put a login form on index.php?

I presume you don’t want “guests” to see anything on your site before they log in and that’s why you want the login form in index.php

For that you can use this in actionIndex



half correct… :) i’m just implementing the login form in an the admin section i created. it’s a separate index.php from the main application…

thanks for the heads up :D

oh man… i did what you said and added

<?php    if(Yii::app()->user->isGuest)

            $this->actionLogin(); ?>

but the same error shows up.

i think the problem is within SiteController.php


changed $form=new LoginForm; to $model=new LoginForm;

and added an assets folder in the same level as admin’s index.php :) outside protected. :) thanks!


i got the same error


can you please help me out

In tab5.php

<div class="ovfl-hidden" id="div_tabTwo" style="width:900px" >

    <div class="top1">

      <div>Past Information</div>


 	<div id="contentbar" class="fl" style="width:900px" align="left" >

      <div class="ovfl-hidden " >

          <div class="bg ovfl-hidden paddAll ">

	       <fieldset class="b_frame">

   		     <legend class="fs_frame"><h3>Past Information</h3></legend>


            <table  width="800">

			<tr >



                    	<?php echo $form->labelEx($preEmployer,'employer'); ?>















        <div class="end">




in controller

public function actionCreate()


		$model=new Jobseekers('create');

		$model1= new preEmployer();


















Hi Walkman2508

you did not post the most relevant code/info…

Please write the exact error message you get… also in the controller you are rendering the “create” view but you posted the tab5.php source… also in the tab5.php you are calling labelEx() with the variable $preEmployer… and while in the controller you have ‘preEmployer’=>$preEmployer in the actionCreate method there is no code that defines the $preEmployer variable.