How to pass form model through GET in Yii 1.x

How can I create a URL for a Yii form with existing model parameters in a URL?

For example, I have one $modelwith some attributes and I want to get the URL like this:

controller/formaction?Form%5Battr1%5D=VAL1&Form%5Battr2%5D=VAL2
+4
source share
3 answers

Unable to configure URL when using the GET method. When you use the GET method, the browser is always united nameand valueall entrances to your line of action form. Therefore, it cannot be changed. One possible solution for getting ugly URLs is to use POST instead of GET.

0
source

You can create such URLs as follows:

Yii::app()->createUrl('controller/formaction', [
    CHtml::activeName('Form', 'attr1') => 'VAL1',
    CHtml::activeName('Form', 'attr2') => 'VAL2',
]);
0
source

Have you tried something like this:

public function action formaction(){
  $form = Yii::app()->request->getQuery('Form',false);
}
-1
source

All Articles