CForm submitted in controller

i have view with such form $form=$this->beginWidget(‘CActiveForm’); in this form several buttons, is it possible to check what button was submitted in controller using submitted instead of $_POST[‘button_name’]?

No, you have to use $_POST[‘button_name’].

Yii is not event triven, there are no method like $button->submitted

but class CForm has method submitted, why i can’t use it?

That tells you if that was the CForm that was submitted, i.e. if there was several CForms on the same page. It won’t tell you which button was clicked however. You need to test if the name is in the POST array for this, only because IE doesn’t implement buttons correctly though.

i has only one form, and several submit buttons

i can make form using chtml::beginform instead of beginWidget(‘CActiveForm’)

but i can’t understand HOW can i use such code like CForm::submitted in controller where form submits

Is the first time that I read about this mehtod, I was always happy using $_POST[‘button_name’].

Anyway, looking at the documentation of CForm looks like that is possible to call:


$form->submitted('button_name');

Wich returns


 isset($_GET[$name]);

Sorry if the first answare was wrong. Can you tell us if it works?

in my first post i wrote that i know about checking $_POST[‘button_name’], so i simply want to know if it possible to use CForm::submitted, because if it exists so i can use it