Re: [QuickForm] How should i use applyFilter()

From: Date: Wed, 29 May 2002 21:33:39 +0000
Subject: Re: [QuickForm] How should i use applyFilter()
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1513@lists.php.net to get a copy of this message
Bertrand Mansion wrote: >$form = new HTML QuickForm('frmTest', 'GET'); > >$form->addElement('text', 'itxtTest', 'Test Text:'); >$form->addElement('submit', 'submit', 'submit'); >$form->addRule('itxtTest', 'Test text is required', >'required'); >$form->applyFilter('__ALL__', 'trim'); > >if ($form->validate()) { > $form->freeze(); > echo 'Before filter:<pre>'; > echo $form->getElementValue('itxtTest'); > echo '</pre>'; > echo 'After filter:<pre>'; > var dump($form->_submitValues['itxtTest']); > echo '</pre>'; >} >$form->display(); Aren't variables prepended with underscore (_) marked private? Also when i type into text field "Foo'Bla" i will get (because of magic_quotes_gpc setting): echo $form->_submitValues['itxtTest']; // == Foo\'Bla and (because of stripslashes along the code): echo $form->getElementValue('itxtTest'); // == Foo'Bla I like the second one.

« previous php.pear.general (#1513) next »