-- umpirsky <umpir...@gmail.com> wrote (on Tuesday, 23 June 2009, 07:07 AM -0700): > Anyone? > > Why this validator use cache at all?
Zend_Translate has optional cache integration, and is being consumed by Zend_Locale, which is in turn being used internally in the validator. I'm looking into why, and will get back to you with a solution. Quick question -- what version of ZF are you using? or are you using directly from subversion? > umpirsky wrote: > > > > It works without int validator, you point at Zend_Locale which I don't use > > on this site, right? > > So, what would be the fix if I want to keep this validator? > > > > Regards, > > Sasa Stamenkovic. > > > > > > Matthew Weier O'Phinney-3 wrote: > >> > >> -- umpirsky <umpir...@gmail.com> wrote > >> (on Monday, 22 June 2009, 08:36 AM -0700): > >>> This is my form: > >> > >> What happens if you remove the "Int" validator from that element? If it > >> works, I think I know what the issue might be. > >> > >> > >>> class Umpirsky_Form_Encryption extends Zend_Form { > >>> /** > >>> * Initialize form, add elements. > >>> */ > >>> public function initialize($suffix, $textName, $textValue, > >>> $encryptionSize, > >>> $hiddenName, $hiddenValue, $submitName, $delete) { > >>> $this->setDecorators(array( > >>> 'FormElements', > >>> array('HtmlTag', array('tag' => 'fieldset')), > >>> 'Form' > >>> )); > >>> $text = new Zend_Form_Element_Text(array('id' => $textName . > >>> $suffix, > >>> 'name' => $textName, 'value' => $textValue, 'class' => 'text')); > >>> $text->setLabel('Name:'); > >>> $text->setDecorators(array( > >>> 'ViewHelper', > >>> array(array('descBreak' => 'HtmlTag'), array('tag' => > >>> 'br', > >>> 'placement' > >>> => Zend_Form_Decorator_Abstract::PREPEND)), > >>> 'Label', > >>> array('HtmlTag', array('tag' => 'p')) > >>> )); > >>> $text->setRequired(true); > >>> $text->addValidator(new Zend_Validate_StringLength(1, 32)); > >>> $this->addElement($text); > >>> $text2 = new Zend_Form_Element_Text(array('id' => > >>> 'EncryptionSize' . > >>> $suffix, 'name' => 'EncryptionSize', 'value' => $encryptionSize, 'class' > >>> => > >>> 'text')); > >>> $text2->setLabel('Size:'); > >>> $text2->setDecorators(array( > >>> 'ViewHelper', > >>> array(array('descBreak' => 'HtmlTag'), array('tag' => > >>> 'br', > >>> 'placement' > >>> => Zend_Form_Decorator_Abstract::PREPEND)), > >>> 'Label', > >>> array('HtmlTag', array('tag' => 'p')) > >>> )); > >>> $text2->addValidator(new Zend_Validate_Int()); > >>> $this->addElement($text2); > >>> $hidden = new Zend_Form_Element_Hidden(array('id' => > >>> $hiddenName . > >>> $suffix,'name' => $hiddenName, 'value' => $hiddenValue)); > >>> $hidden->setDecorators(array( > >>> 'ViewHelper' > >>> )); > >>> $this->addElement($hidden); > >>> $submit = new Zend_Form_Element_Submit(array('id' => 'submit' . > >>> $suffix, > >>> 'name' => $submitName)); > >>> $submit->setDecorators(array( > >>> 'ViewHelper', > >>> 'Description' > >>> )); > >>> $this->addElement($submit); > >>> if ($delete) { > >>> $delete = new Zend_Form_Element_Submit(array('id' => > >>> 'delete' . > >>> $suffix, > >>> 'name' => 'Delete')); > >>> $delete->setDecorators(array( > >>> 'ViewHelper', > >>> 'Description' > >>> )); > >>> $this->addElement($delete); > >>> } > >>> } > >>> } > >>> > >>> When I remove text2, it works ok, like this > >>> > >>> class Umpirsky_Form_Encryption extends Zend_Form { > >>> /** > >>> * Initialize form, add elements. > >>> */ > >>> public function initialize($suffix, $textName, $textValue, > >>> $encryptionSize, > >>> $hiddenName, $hiddenValue, $submitName, $delete) { > >>> $this->setDecorators(array( > >>> 'FormElements', > >>> array('HtmlTag', array('tag' => 'fieldset')), > >>> 'Form' > >>> )); > >>> $text = new Zend_Form_Element_Text(array('id' => $textName . > >>> $suffix, > >>> 'name' => $textName, 'value' => $textValue, 'class' => 'text')); > >>> $text->setLabel('Name:'); > >>> $text->setDecorators(array( > >>> 'ViewHelper', > >>> array(array('descBreak' => 'HtmlTag'), array('tag' => > >>> 'br', > >>> 'placement' > >>> => Zend_Form_Decorator_Abstract::PREPEND)), > >>> 'Label', > >>> array('HtmlTag', array('tag' => 'p')) > >>> )); > >>> $text->setRequired(true); > >>> $text->addValidator(new Zend_Validate_StringLength(1, 32)); > >>> $this->addElement($text); > >>> $text2 = new Zend_Form_Element_Text(array('id' => > >>> 'EncryptionSize' . > >>> $suffix, 'name' => 'EncryptionSize', 'value' => $encryptionSize, 'class' > >>> => > >>> 'text')); > >>> $text2->setLabel('Size:'); > >>> $text2->setDecorators(array( > >>> 'ViewHelper', > >>> array(array('descBreak' => 'HtmlTag'), array('tag' => > >>> 'br', > >>> 'placement' > >>> => Zend_Form_Decorator_Abstract::PREPEND)), > >>> 'Label', > >>> array('HtmlTag', array('tag' => 'p')) > >>> )); > >>> $text2->addValidator(new Zend_Validate_Int()); > >>> //$this->addElement($text2); > >>> $hidden = new Zend_Form_Element_Hidden(array('id' => > >>> $hiddenName . > >>> $suffix,'name' => $hiddenName, 'value' => $hiddenValue)); > >>> $hidden->setDecorators(array( > >>> 'ViewHelper' > >>> )); > >>> $this->addElement($hidden); > >>> $submit = new Zend_Form_Element_Submit(array('id' => 'submit' . > >>> $suffix, > >>> 'name' => $submitName)); > >>> $submit->setDecorators(array( > >>> 'ViewHelper', > >>> 'Description' > >>> )); > >>> $this->addElement($submit); > >>> if ($delete) { > >>> $delete = new Zend_Form_Element_Submit(array('id' => > >>> 'delete' . > >>> $suffix, > >>> 'name' => 'Delete')); > >>> $delete->setDecorators(array( > >>> 'ViewHelper', > >>> 'Description' > >>> )); > >>> $this->addElement($delete); > >>> } > >>> } > >>> } > >>> > >>> > >>> Any idea? > >>> > >>> Regards, > >>> Sasa Stamenkovic. > >>> -- > >>> View this message in context: > >>> http://www.nabble.com/Strange-Zend_Form-cache-problem%2C-please-URGENT-tp24148767p24149251.html > >>> Sent from the Zend Framework mailing list archive at Nabble.com. > >>> > >> > >> -- > >> Matthew Weier O'Phinney > >> Project Lead | matt...@zend.com > >> Zend Framework | http://framework.zend.com/ > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/Strange-Zend_Form-cache-problem%2C-please-URGENT-tp24148767p24166738.html > Sent from the Zend Framework mailing list archive at Nabble.com. > -- Matthew Weier O'Phinney Project Lead | matt...@zend.com Zend Framework | http://framework.zend.com/