Default Validations

Hai everyone.

I have just started a new yii project. First I have created a table in mysql with all the fields as null constraint.Later requirement got changed I have made all the columns as not null constraint. So While creating the users with that table crud form, i.e if the admin guy dint select or without entering any values in columns its not giving the errors. It suppose to give the validations like please enter value in that field like that right.

And here is the table structure.

CREATE TABLE explanationmaster (

id int(9) NOT NULL auto_increment,

sourcelanguage int(5) NOT NULL,

targetlanguage int(5) NOT NULL,

description text NOT NULL,

isactive tinyint(1) default NULL,



Can any one tell me what is wrong I have done in that application.

Looking for your nice answers.

Kind Regards


Hai everyone The same user again.

Here is what some more in detail.

First I have created a table with all null constraint columns. In generating the crud it was not giving any error because all are nullable columns. Later I had to modified all the columns as not null constraints.I have made it.But in crud applications if I use its form and click create with out giving any values its not giving any validation errors. If the column is not null constraint it suppose to give an validation error right.

Can any body tell me how to get the validation errors on a altered table.


Shaik Mussarath


You can try setting "allowEmpty" validator option to false.

Hai Sam

Yes I have tried this setting the allowblank to false property.But its still not validating it.

Here is the code.

<div class="row">

&lt;?php echo &#036;form-&gt;labelEx(&#036;model,'description'); ?&gt;

&lt;?php echo &#036;form-&gt;textField(&#036;model,'description',array('size'=&gt;40,'maxlength'=&gt;200,'allowEmpty'=&gt;false)); ?&gt;

&lt;?php echo &#036;form-&gt;error(&#036;model,'description'); ?&gt;&lt;


If you can help me it would be really nice.



Dear Shaik,

Would you please try the following?

In ExplanationMaster.php, please modify the rules method to incorporate the following rules.

public function rules()


   return array(


	array('isactive', 'default','value'=>null,'setOnEmpty'=>false),//this is not going to throw errors