RadioButtonList without a model

Hi All,

I am using pdf extension for cgridview to pdf report.

It works fine in each of my models.

What I want to do now, is to access all of them from 1 view. Eg: I want to have a form with a radiobuttonlist (8 buttons) and a "Generate" button. Depending on which radio button I select, I want to show the corresponding report when I press "Generate"…

How can I do this?

And is it possible to have a Controller + View without a Model?

It’s default for the Controller + View to be without a Model.

I think what you mean is “is it possible to operate on a form data without a model?” and yes - it’s possible but not that convenient (validation for example).

You can prepare the form in the view and the controller just picks up the POST data. In this case you can return the proper view based on chosen radio option.

Thank you Bizley for your reply.

Can you help me with an example? How do I get which radio button was chosen from the controller?

In the same action I have to do the "switch case"?

Thank you in advance.

Let say your view is:

<form action="URL_TO_ACTION" method="post">

<input type="radio" name="model" value="1"> Report for Model 1<br>

<input type="radio" name="model" value="2"> Report for Model 2<br>

<input type="radio" name="model" value="3"> Report for Model 3<br><br>

<input type="submit" name="generate" value="Generate">


So in controller’s action:

$report = Yii::app()->request->getPost('model');

switch ($report) {

    case '1': $view = 'report1'; break;

    case '2': $view = 'report2'; break;

    case '3': $view = 'report3'; break;

    default: $view = 'default_view';



This is just one of many variations.

Thank you for your help :)