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.
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,
PRIMARY KEY (
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=60 ;
Can any one tell me what is wrong I have done in that application.
Looking for your nice answers.
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.
You can try setting "allowEmpty" validator option to false.
Yes I have tried this setting the allowblank to false property.But its still not validating it.
Here is the code.
<?php echo $form->labelEx($model,'description'); ?>
<?php echo $form->textField($model,'description',array('size'=>40,'maxlength'=>200,'allowEmpty'=>false)); ?>
<?php echo $form->error($model,'description'); ?><
If you can help me it would be really nice.
Would you please try the following?
In ExplanationMaster.php, please modify the rules method to incorporate the following rules.
public function rules()
array('isactive', 'default','value'=>null,'setOnEmpty'=>false),//this is not going to throw errors