I have some fields in my database with NULL as their default value. With the form created by the yiic command, these fields display by default the “NULL” string. I would want to display an empty string instead. How can i do that ? I browse the docs but i can’t find anything related to this subject.
you have to change Null to Not Null and set the default value to an empty string in you database. use phpmyadmin or something to edit you field in your tables.
Yes, it’s a solution. But i was wondering if there is an other solution on the Yii side ? May be like a post-filter which would automatically convert the “NULL” string to the empty string if the SQL value is null before displaying the form.
In my case, i can modify my database structure so i could indeed change the default value in my table. But sometimes you can’t make this kind of change.
Sure but Yii reads the fields values from the database. So, there is no way to convert the fields values read in the database by Yii just before the display in the form ? Something like this :
DB values -> Yii read these values -> ** Filter to convert null to empty string ** -> Form display (without any null)