Validator-Pfad für Zend-Form setzen

10.02.2014 | Zend Framework

Validator-Klassen unter /library/Imi/Validate/... class Application_Form_Codesubmit extends Zend_Form { protected $_productOptions = array( '' => 'Gekauftes Produkt*'); public function

Validator-Klassen unter /library/Imi/Validate/...



class Application_Form_Codesubmit extends Zend_Form
{

    protected $_productOptions =  array( '' => 'Gekauftes Produkt*');

    public function __construct($options = null)
    {
        parent::__construct($options);
        $this->addElementPrefixPath('Imi_Validate_','Imi/Validate','validate');
        $this->setElementFilters(array('StringTrim', 'StripTags'));
        $this->getElement('captcha')->removeFilter('StringTrim');
        $this->getElement('captcha')->removeFilter('StripTags');
    }

    public function init()
    {
      ....


 

Validator-Klasse z.B.:


<?php

class Imi_Validate_Ibancountry extends Zend_Validate_Abstract
{
   ....

Analyse

Entwurf

Development

Launch