I have built a zend form element for html content (general notes).
class Sistema_Form_Note extends Zend_Form_Element_Xhtml {
public $helper = 'formNote';
public function isValid($value){
return true;
}
}
It's working fine however it goes as a field and when I go to insert the post data on my database, the index note element appears.
POST array('name' => 'John'
'note1' => ...);
How could I remove it without using the removeElement()
method on the controller? Is there any way to tell on the class it shouldn't be a "db field"?
Thanks
I figured out, looking how submit button is removed, It can be solved overring contruct method and passing ignore option as true.
class Sistema_Form_Note extends Zend_Form_Element_Xhtml {
public $helper = 'formNote';
public function __construct($spec, $options = null)
{
if (is_string($spec) && ((null !== $options) && is_string($options))) {
$options = array('label' => $options);
}
if (!isset($options['ignore'])) {
$options['ignore'] = true;
}
parent::__construct($spec, $options);
}
public function isValid($value){
return true;
}
}