Yii Framework Forum: Createurl Params From Form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Createurl Params From Form Rate Topic: -----

#1 User is offline   Belyj_Vladislav 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 01-May 13
  • Location:Ukraine, Dnepropetrovsk

Posted 05 May 2013 - 01:33 PM

Sorry for my no ideal English!

In need change url from 'ad?region=dp&city=zp' to ad/dp/zp.

I know, that I can do this with UrlManager. But I have a problem with a GET form-filter: I can not paste to form action createUrl $params from this form field.

My form:
$form=$this->beginWidget('CActiveForm', array(
     'action'=>Yii::app()->createUrl('ad', array('region'=> here I need paste value from region, 'city' => here I need paste value from city)),
echo $form->dropDownList($region,'name', $regions, array(
	'name' => 'region',
	'options' => array($_GET['region']=>array('selected'=>true)),
echo $form->dropDownList($city,'name', $cities, array(
	'name' => 'city',
	'options' => array($_GET['city']=>array('selected'=>true)),


How I can do this? And Do I correctly understand the logic of form-filter?

Thank You!

#2 User is offline   Fabrizio Caldarelli 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,072
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 06 May 2013 - 03:08 AM

city and region are not field of your model (CActiveRecord's subclass or CFormModel) ?
Yii2 by example: my book about Yii2

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users