2008年8月14日星期四

Re: [fw-mvc] Zend_Form Filters, my error or Bug?

What we wish is that the control, take the 2 filters, but only stays with
one.
That filters .ini file was added to all checks and not replace the filters
they have, does it mean?


Matthew Weier O'Phinney-3 wrote:
>
> -- Benjamin.Gonzales <iadvmc@yahoo.com> wrote
> (on Thursday, 14 August 2008, 10:00 AM -0700):
>>
>> any idea?
>
> Trim only trims the first or last item of whitespace, not all
> surrounding whitespace.
>
>
>> Benjamin.Gonzales wrote:
>> >
>> > I will put a very simple example
>> >
>> > form.ini
>> > ;GLOBAL FILTER RULES
>> > [global]
>> > elementFilters.trim.filter = "StripTags"
>> >
>> > //EmployeeForm.php
>> > class EmployeeForm extends Zend_Form
>> > {
>> > public function init()
>> > {
>> > $this->setName('Employee');
>> > $this->setMethod('post');
>> > $element1 = new Zend_Form_Element_Text('emp_name', array(
>> > 'attribs' => array('size'=>'25','maxlength'=>'30'),
>> > 'required' => true,
>> > 'label' => 'Name' ,
>> > 'filters' => array('StringTrim') // filter fails
>> > ));
>> > $this->addElements(array('$element1'));
>> > $this->addElement('submit', 'test', array('label' => 'test'));
>> >
>> > }
>> > }
>> >
>> > //EmployeeController.php
>> > class EmployeeController extends Zend_Controller_Action
>> > {
>> > public function testAction(){
>> >
>> > $config = new Zend_Config_Ini('/config/form.ini');
>> > $form = new $form;
>> > $form->setConfig($config->global);
>> > $this->view->form = $form;
>> >
>> > if ($this->_request->isPost()){
>> >
>> > var_dump($form->getValues());
>> > }
>> > }
>> >
>> > }
>> >
>> > //var_dump
>> > ["emp_name"]=>string(9) "my text " // The filter "StringTrim" does
>> not
>> > work
>> >
>> >
>> > Apparently this is my INI file overwriting
>> >
>> > He sought an alternative solution, using addFilter, but there is
>> another
>> > way to do it?
>> >
>> >
>> >
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Zend_Form-Filters%2C--my-error-or-Bug--tp18895969p18985603.html
>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>
>
> --
> Matthew Weier O'Phinney
> Software Architect | matthew@zend.com
> Zend Framework | http://framework.zend.com/
>
>

--
View this message in context: http://www.nabble.com/Zend_Form-Filters%2C--my-error-or-Bug--tp18895969p18988725.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: