RadioButtonList with null

Hi guys,

This is my first project with Yii, hope someone could advise me is this issue.

I tried to search & google around but can’t find anyone have the same issue with me.

Maybe I have something wrong is my code?

Below is my code for my view:


<?php echo $form->radioButtonList($model, 'value', array("1" => "True", "0" => "False")); ?>

When my $model is null this will have exception, I am using if (!is_null($model)) to avoid the exception at the moment, but this will hide my radio button list, wondering is there any better way to solve this?

Thank you in advance for your help.:)