I've tried to make StripTags leave the href attribute, but it strips it out.
I can't find the right syntax or it just doesn't work. The <a> tag is left
intact, every other tag is stripped, but the href and title get stripped as
well.
I've also used the fluid interface when adding the Textarea, but changed it
to what is below in hopes that it would work.
What am I doing wrong?
Thanks,
J
<?php
class Form_NewMessage extends Form_Default {
public function init() {
$this->setMethod('post');
$this->setAttrib('id', 'new_message');
$textarea = new Zend_Form_Element_Textarea('message');
$textarea->setDecorators($this->_defaultDecorators);
$stripTags = new Zend_Filter_StripTags(array('a'), array('href',
'title'));
$textarea->addFilter('StringTrim');
$textarea->addFilter($stripTags);
$textarea->setValidators(array());
$textarea->setRequired(true);
$textarea->setAttrib('cols', 40);
$textarea->setAttrib('rows', 2);
$this->addElement($textarea);
$this->addElement('Submit', 'submit', array(
'Decorators' => array('ViewHelper'),
'class' => 'submit',
'Label' => 'Post Your Message!',
'Ignore' => true,
));
$this->setDecorators(array(
'Description',
'FormElements',
'Fieldset',
'Form'
));
}
}