form label problem

My problem is using:

In my view:


<?php echo $form->labelEx($model,'henkilötunnus'); ?>

<?php echo $form->textField($model,'ht',array('size'=>20,'maxlength'=>11)); ?>

in my model:

I have


public $ht;

and in rules:


array('fname, lname, ht', 'required'),

I would like to have the form input fields name to be different than the label (what the user sees). This site is in Finnish so Henkilötunnus is what I want to be displayed and I would like to have “ht” to be the name of the text input. For some reason Henkilötunnus is displayed as: Henkil�tunnus so the ö is not displayed correctly and I’m sure this applies to all special characters that are used in label. I know I can do a workarround and not do the $form->labelEx($model,‘henkilötunnus’); part. But just want to know what is the “correct” way to do this now before I start by doing things the “wrong” way.

I’m totally new to Frameworks and Yii but I’ve done a lot with php and template engines.

I do understand MVC but I’ve never developed anything using this method.

I’m using Yii 1.1.4 and the example site that came with it as a starting point for a test application I’m making to see if Yii would be a good way for us to make web apps from now on.

Any help would be appreciated.

In the model there is a function AttributeLabel, wich is used for specify the label of each field of the database.




         /**

	 * @return array customized attribute labels (name=>label)

	 */

	public function attributeLabels()

	{

		return array(

			'id' => 'ID',

			'title' => 'T&iacute;tulo',

			'description' => 'Descripci&oacute;n'; // fieldname=>spanish <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/smile.gif' class='bbc_emoticon' alt=':)' />

		);

	}



Then on your view:





<?php echo CHtml::activeLabel($model,'title'); // will display T&iacute;tulo appropiately ?> 




Thanks a lot this solved it for me.

Great it worked out for you…