Can't get form to work with CFormModel

Error line:


<?php echo $form->labelEx($model,'name'); ?>

My Form Model:


<?php


/**

 * SocietyForm class.

 * SocietyForm is the data structure for keeping

 */

class SocietyForm extends CFormModel

{

	public $active=true;

	public $capacity=1000;

	public $name;

	public $description;

	public $price=0.00;


	/**

	 * Declares the validation rules.

	 * The rules state that username and password are required,

	 * and password needs to be authenticated.

	 */

	public function rules()

	{

		return array(

			array('active, capacity', 'name', 'price', 'required'),

			array('name', 'length', 'min'=>3, 'max'=>20),

			array('description', 'length', 'max'=>10000),

			array('active', 'boolean'),

			array('capacity', 'numerical', 'integerOnly'=>true, 'min' => 10, 'max'=>10000),

			array('price', 'numerical', 'integerOnly'=>false, 'min' => 1.00, 'max'=>999.99),

		);

	}


	/**

	 * Declares attribute labels.

	 */

	public function attributeLabels()

	{

		return array(

			'active'=>Yii::t('site', 'Active'),

			'capacity'=>Yii::t('site', 'Capacity'),

			'name'=>Yii::t('site', 'Name'),

			'description'=>Yii::t('site', 'Description'),

			'price'=>Yii::t('site', 'Price'),

		);

	}

}



My action:


public function actionSocieties()

	{

		$model=NULL;

		if(isset($_GET['new']))

		{

			$model=new SocietyForm;

			// if it is ajax validation request

			if(isset($_POST['ajax']) && $_POST['ajax']==='society-form')

			{

				echo CActiveForm::validate($model);

				Yii::app()->end();

			}

			

			if(isset($_POST['SocietyForm']))

			{

				// collects user input data

				$model->attributes=$_POST['SocietyForm'];

				// validates user input and redirect to previous page if validated

				if($model->validate())

					$this->redirect($this->route);

			}

			

		}

		$this->render('societies', array('model'=>$model));

	}

My View


<div class="grid_12">

<?php 

if($model===NULL):

echo CHtml::link('<h3>New society</h3>', array($this->route, 'new'=>1));

?>

<?php else: ?>

</div>

<div class="form">

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

    'id'=>'society-form',

    'enableAjaxValidation'=>true,

    'focus'=>array($model,'name'),

	'htmlOptions'=>array('enctype'=>'multipart/form-data'),

)); ?>


<div class="grid_12">

	<p class="note"><?php echo UserModule::t('Fields with <span class="required">*</span> are required.'); ?></p>

	

	<?php echo $form->errorSummary($model); ?>

</div>


<div class="grid_4">	

	<div class="row">

		<?php echo $form->labelEx($model,'name'); ?>

		<?php echo $form->textField($model,'name', array(

														'maxlength'	=>20,

														'class'		=>'validate[required,custom[onlyLetterNumber],minSize[3],maxSize[20]]'

														)); ?>

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

	</div>

</div>


	<div class="row">

		<?php echo $form->labelEx($model,'capacity'); ?>

		<?php echo $form->passwordField($model,'capacity', array(

															'maxlength'	=>11,

															'class'		=>'validate[required,custom[number],min[10],max[10000]]'

															)); ?>

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

	</div>

    

	<div class="row">

		<?php echo $form->labelEx($model,'price'); ?>

		<?php echo $form->passwordField($model,'price', array(

															'maxlength'	=>11,

															'class'		=>'validate[required,custom[number],min[1],max[999.99]]'

															)); ?>

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

	</div>


	<div class="row">

		<?php echo $form->labelEx($model,'description'); ?>

		<?php echo $form->textField($model,'description', array(

														'maxlength'	=>10000,

														'class'		=>'validate[maxSize[10000]]'

														)); ?>

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

	</div>

		

	<div class="row rememberMe">

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

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

	</div>


	<div class="row submit">

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

	</div>

	

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

</div>

<script type="text/javascript">

	$("#society-form").validationEngine();

</script>

</div>

<?php endif; ?>

</div>

its exactly what i use to register and login and it works

what i need more here?

thanks

any idea? still not work

please help, i can’t get it to work :(

I think the error is in the first rule


array('active, capacity', 'name', 'price', 'required'),

shouldn’t be


array('active, capacity, name, price', 'required'),

if you say so ;) it works :D

strange why i didn’t see this before, maybe because yii is a new world to me ;)

Thanks!