A
A
Andrew2016-07-05 00:25:24
Zend Framework
Andrew, 2016-07-05 00:25:24

Zen in Framework1: How to add to a form field a notation that the field is required?

How to add a symbol in zend framework, for example a standard red asterisk, that the field is required?
The form is created via new Zend_Form_Element_Text('title');, in the usual form, I would add to the label But it's not clear with zend
<span style="color:#f00;">*</span>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Cat Anton, 2016-07-05
@ntzch

stackoverflow.com/questions/12163636/what-is-best-...
If I'm not mistaken, this is done through a decorator. More or less like this:

$element = Zend_Form_Element_Text('title');
// ...
$element->getDecorator('Label')->setRequiredSuffix('<span style="color:#f00;">*</span>');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question