RadioButtonList bug with the disable attribute

Hi everyone,

I have a question regarding the RadioButtonList…and i think its a bug with yii but not sure.

When i add the attribute ‘disabled’=true to a RadionButtonList and click on the submit button, the radioButtonList are reset and unchecked?? so i have the error message that the radiobuttonList should not be empty !!! and in fact its checked but just disabled “readonly”

On firebug the radio button are checked when its disabled, but why yii reset the radio button when i submit the page after adding the attribute disabled=>true ?

Thanks

By w3c standards, disabled fields are not sent to the server

try using a hidden field instead

Thanks for the reply.

I use the same form for creating and updating. So on the update mode, the user should not update the radioButtonList values,

that’s why i have to add the disable attribute. A hidden filed will not be appropriate for what i want to do

Thanks


if($model->isNewRecord)

  $form->radioButtonList(...);

else

  $form->hiddenField(...);

should do

A disable text field is sent but not a radiobutton !

But the user have to see the value of the radiobutton but should not be able to make changes. With the hiddenField he can’t see the values .

create a hidden field if it is not a new record and disable that radio


$form->radioButtonList(...,array('disabled'=>!$model->isNewRecord));//or something like that

if(!$model->isNewRecord)

    $form->hiddenField(...);



that should do