I’m trying to build a page where I can pick an engineer from a dropdown list.
Once selected I want to hit a GO button and have the browser open a new tab and make a HTTP request to a URL with the engineerid appended to the the URL - http://localhost/index.php?/foo/bar/workshop?engineerid=123
So far I have an CActiveForm - OK
I have my populated dropdown list - OK
I have the GO button open a new page on submission (‘target’=>’_blank’) - OK
I have the URL set exactly where I want - OK
The problem I have is appending the engineerid parameter to the end of the URL, so for all it does is append Engineer[id]=1, which is then getting URL encoded.
I’m guessing I’m hitting some Yii uniqueness on how CActiveForm is meant to behave, is there a better way?
$form2 = $this->beginWidget('CActiveForm',
array('id'=>'viewshop-form',
'method'=>'GET',
'action'=>array('/foo/bar/workshop'),
'htmlOptions'=>array(
'target'=>'_blank')
));
echo $form2->labelEx($engineer, 'View Workshop');
echo $form2->dropDownList($engineer,'id',
CHtml::listData(Engineer::model()->findAllByAttributes(array('enabled'=>1)), 'id', 'user.name'));
echo CHtml::submitButton('Go', array('submit'=>$engineer->id));
$this->endWidget();