Is there a simple way to automate this without having to subclass the
default Label decorator? Or would a simple loop suffice before
rendering. Something like:
foreach ($form->getElements () as $element) {
$label = $element->getDecorator('label');
if (!$element->isValid ()) {
$label->setOption('class', 'error');
}
}
Or is there something I'm missing?
--
Mathew Byrne
On 08/02/2008, at 1:50 AM, Matthew Weier O'Phinney wrote:
-- drews <[EMAIL PROTECTED]> wrote
(on Thursday, 07 February 2008, 06:16 AM -0800):
Noé Froidevaux-2 wrote:
How can I highlight in red all inputs witch have errors (for example
with changing the class when the field have an error)?
one possibility would be to go via decorator and add/change the
styleclass
for the label:
$element->setDecorators(array(
array('ViewHelper',
array('helper' => 'formText')),
array('Label',
array('class' =>
'error'))
)
);
You don't need to re-add the decorators to modify them. :-)
$label = $element->getDecorator('label');
$label->setOption('class', 'error');
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/