How to replace one GET var in Yii 1.1.* when using form?

I’ve needed URL with one variable replaced so it wouldn’t be duplicated every request. I’ve came up with this simple solution:

I think it’s lot better than using regular expressions ๐Ÿ˜‰


File: view.php
--------------

controller->createUrl( Yii::app()->controller->id . '/' . Yii::app()->controller->action->id, $params );

/**
 * Create form with nedded c param included.
 */
echo TbHtml::beginFormTb(TbHtml::FORM_LAYOUT_INLINE, $url, 'GET', [ 'class' => 'plugin-submit-onchange' ]); 
echo TbHtml::label('Number of items in list:', 'c');
echo TbHtml::dropDownList( 'c', $this->_c, $this->options ); 
echo TbHtml::endForm(); 
?>



Posted

in

, ,

Tags: