2008年12月16日星期二

[fw-mvc] Adding * to label

Hi,

Currently I am using

$element->getDecorator('label')->setOption('requiredSuffix', ' * ');

to add * to required fields.

I want to manage the markup from a centrally accessible place. Perhaps,
a custom label decorator. If I wish to change the markup to
<em>*</em> or to
<div class="redAsterisk">*</div>
it would be convenient to change it in one place.

I just want to add this functionality to the label decorator and leave
all else as is.

What is the best method to accomplish this? I have seen some people
adding * using CSS. I prefer to print the text character * and style it
using CSS.

It would be much more convenient if the custom decorator can check
whether the element isRequired() and then add * to the label. But I
can't figure out how to do it.

Code examples would be highly appreciated.

--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, Personal: http://sudheer.net

没有评论: