Active Form: How Can I Disable Encoding All The Values Of Every Field.

Hello I am using an ActiveForm, and I amm using different languages, so I need to add to any textField, labelEx, etc… encode=> false, but this is something I realize now,

when new language have been added to project. My question is clear, there is a way that encode equal to false for the whole fields in the form, Instead or edit the whole project and look

for any textfield and add it at the end array(‘encode’=>false), just do it in the CActiveForm Widget declaration.

This is my code:


<?php 

$this->beginWidget('CActiveForm', array(

				'id'=>'someId',

				'enableClientValidation'=>true,

				'htmlOptions'=>array('class'=>'someClass')	

				))}

 echo $form->textField($model,'city',array('encode'=>false));

// an a lot of fields more

$this->endWidget();

 ?>

this is what I want to:


<?php 

$this->beginWidget('CActiveForm', array(

				'id'=>'someId',

				'enableClientValidation'=>true,

				'htmlOptions'=>array('class'=>'someClass',SOME OPTION HERE AND ALLWAYS encode IS EQUAL TO FALSE)	

				))}

 echo $form->textField($model,'city');

// an a lot of fields more

$this->endWidget();

 ?>

And better, I solution for all the form in all the views, just code it in some general place.

Thanks in advance !

No answers ? :rolleyes:

Why do you need it, exactly? I never ran into any problem with encoded text field values or labels in multilingual applications and it doesn’t seem to be a good idea to disable encoding. CActiveForm uses CHtml::encode() internally. It’s just a wrapper for htmlspecialchars() and won’t affect language specific characters.