Add warning form

Hi,

I am dealing with students and class.

I can select a class for a student in the update form. If there is more than 25 students in a class, it’s ok but i must show a warning. This warning must be validate by user, so i can’t use flash message for this. I want to show a form with the warning and a ok button, when the user click on it, the displayed form must be the view of the student.

In my controller, i do this:




...

if($class->class_id > 0 && $class->studCount >= 25)

{	// affichage d'un message d'avertissement

        $this->render('/student/avertissement_25_etudiants', array("model" => $model));

	return;

}

$this->redirect(array('view','id'=>$model->student_id));

...



In the warning form, i have a button which would redirect me to the view of the student:




$this->widget('zii.widgets.jui.CJuiButton',

array(

	'name'=>'button',

	'caption'=>'OK',

	'onclick'=>'

	{

		window.open("/student/view", "Vue", array("id"=>$model->student_id));

	}',

));



But when i’m clicking on the button, the open form is my start form (update student) instead of the view.

Does anyone has an idea?

… Nobody?

Hi,

try this code:




$this->widget('zii.widgets.jui.CJuiButton',

	array(

		'name'=>'button',

		'caption'=>'OK',

		'buttonType'=>'link',

		'url'=>array('student/view', 'id'=>$model->student_id),

	)

);



Thank a lot MadAnd!