Activelabelex() With Custom Text

Suppose I have the following:


<?php echo $form->labelEx($user, 'email_address'); ?>

in attributeLabels() function I have:


'email_address' => 'Email Address',

On the main signup form the label is displayed as per above. However in the user account area the label needs to be displayed as: ‘Your Email Address:’

Now I know I can just manually enter this text as the second parameter of labelEx(), however this means it is no longer a ‘model’ label and as such it won’t render the “required” asterisk and nor will it highlight upon error.

So what is the best way of going about this?

You can modify your attributeLabels() function to return different results based on some variable value. Scenario could be a nice candidate.

Anyone got any more ideas?

This works:


<?php echo $form->labelEx($user, 'email_address', array('label'=>'Your Email Address:')); ?>

Dear Friend

One can use the option "label" in htmlOptions.




?php echo $form->labelEx($user, 'email_address',array('label'=>'Your Email Address:')); ?>



Edit:Sorry You have got it. I was not aware of it.