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 <[email protected]> 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 | [email protected] > Zend Framework | http://framework.zend.com/ > > -- View this message in context: http://www.nabble.com/Strange-Zend_Form-cache-problem%2C-please-URGENT-tp24148767p24150353.html Sent from the Zend Framework mailing list archive at Nabble.com.
