1

I am trying to add CSS Class & inline style to a form element's/decorator. I tried

$this->addElement('text', 'honeypot', array(
    ...
    'decorators' => array(
        'ViewHelper',
        'Label',
        array('HtmlTag', array('tag' => 'p', 'class' => 'honeypot', 'style' => 'display: none'))
    )
));

But the <p> didn't have the class & style attributes attached

1 Answer 1

1

Works fine for me. Are you resetting the element decorators later on using Zend_Form::setElementDecorators() or something similar?

alt text

FYI, you should probably have a semi-colon after your inline style rule, eg

'style' => 'display: none;'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.