How To Urldecode Within Dropdownlist

I am using dropDownList within my form and pulling data from a database.

The field(name) gets stored with urlencode, and I need to update it to urldecode when viewing. When just grabbing this variable without the dropdownlist or array, urldecode($row[‘name’]) works just fine.

The snippet of my code is below.




	$models = questionnaires::model()->findAll(array('group' => 'organisationid', 'order' => 'name'));

	$list = CHtml::listData($models, 'organisationid', 'name');

?>

	

	 <div id="create" class="row">

            <?php echo CHtml::activeLabel( $model, 'client' ); ?>

            <?php echo CHtml::dropDownList('client','0', $list, array('empty' => 'Select a client')); ?>

	</div>



you can pass a closure to listData




<?php




CHtml::listData($models,'id',function($model) {

	return urlencode($model->name);

});