Yii 1.1: "Repeated use" of CHtml::beginForm() makes URL longer and longer

I have a very simple form that looks like this:


$id=Yii::app()->request->getParam('id',null);

$date=Yii::app()->request->getParam('date',null);

$allItems=Items::model()->findAll(array('select'=>array(Items::ID,Items::NAME),'order'=>Items::NAME));

echo CHtml::form('','get');

echo CHtml::dropDownList('id', $id,

        CHtml::listData($allItems, Items::ID,

                function ($item) {

                    return CHtml::encode($item->{Items::NAME} . " " . $item->{Items::ID});

                }),array('empty'=>'All'));


echo CHtml::dateField('date',$date,array('id'=>'datefield'));

if($date!==null) {

	echo CHtml::submitButton('-',array('onclick'=>new CJavaScriptExpression('document.getElementById("datefield").stepDown(1);')));

	echo CHtml::submitButton('+',array('onclick'=>new CJavaScriptExpression('document.getElementById("datefield").stepUp(1);')));

}

echo CHtml::submitButton('OK');

echo CHtml::endForm();

The purpose of the form is that the user can select an item and a date so that information regarding the item on that date displays below the form. The ‘+’ and ‘-’ buttons allow a quick update of the date to make searching easier.

For fast development and given the use, this is HTML5.

A nice thing with ‘CHtml::beginForm()’ is that it interprets the get parameters and lists them as hidden fields. I hadn’t noticed that before. However the bad thing with that is that it lists all the get parameters as hidden fields and on every ‘Submit’, the URL just gets longer and longer as duplicates are not removed. At some point in time this makes the URL too long to be accepted by the server.

I think that ‘CHtml::beginForm()’ should ‘optimize’ the hidden fields by removing the duplicates.