-- Bagus Nugroho <[EMAIL PROTECTED]> wrote (on Wednesday, 05 November 2008, 06:40 PM +0700): > I'm key in '1000asdf' on input text. > Like this one : > ================ > public function testAction(){ > $form = new My_Form_Project_Test(); > > if($this->_request->isPost()){ > print_r($this->_request->getPost()); > }else{ > echo $form; > } > } > > and the output like this : > Array ( [test] => 1000asdf [submit] => Submit )
Well, you need to pass the data to the form's or element's isValid() method -- it doesn't get automagically validated or filtered for you. You need to do the following: $request = $this->getRequest(); if ($request->isPost() && $form->isValid($request->getPost())) { print_r($form->getValues()); } else { echo $form; } (It's better to do that echoing in the view script, though -- the above is just for demonstration purposes.) > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ > From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] > Sent: Sel 04-Nop-2008 23:06 > To: fw-general@lists.zend.com > Subject: Re: [fw-general] Filter Digits on Zend_Form > > > -- Bagus Nugroho <[EMAIL PROTECTED]> wrote > (on Tuesday, 04 November 2008, 10:18 PM +0700): > > I'm trying using 'Digits' filter on Zend_Form like this : > > ====== > > class My_Form_Project_Test extends Zend_Form{ > > public function __construct($options = null){ > > parent::__construct($options); > > > > $update = new Zend_Form_Element_Text('test'); > > $update->setLabel('Test') > > ->addFilter('Digits'); > > > > > > $submit = new Zend_Form_Element_Submit('submit'); > > $submit->setLabel('Submit'); > > > > > > $this->addElements(array($update, $submit)); > > } > > } > > > > then, when input '1000asdf', I'm expecting get '1000' but the code above > > give > > me '1000asdf' instead of '1000' as expected. > > Is any wrong with my code above. > > How are you retrieving the element value? > > -- > Matthew Weier O'Phinney > Software Architect | [EMAIL PROTECTED] > Zend Framework | http://framework.zend.com/ > > -- Matthew Weier O'Phinney Software Architect | [EMAIL PROTECTED] Zend Framework | http://framework.zend.com/