[TYPO3-project-formidable] Clear search form

Ian Solo ian at webian.it
Thu May 29 23:37:05 CEST 2008


Hello Albert!
I'm trying to achieve the same thing.
I tried your code but I get this error:

*************************************************************************
Fatal error: Call to a member function _isSubmitted() on a non-object in 
f:\documenti\!!!!lavori in 
corso\Plus4you\!www\typo3\ext\ameos_formidable\api\class.tx_ameosformidable.php(5006) 
: eval()'d code on line 16
*************************************************************************

Do you have any idea to solve this?

Thank you in advance!
ian

Albert van der Veen wrote:
> Sorry, a little too fast with concluding this works: this method should 
> be called only when the form has not just been submitted or when you're 
> in a search (otherwise pager doesn't work).
> Adjusted code to below, but still having the feeling this could be done 
> better :)
> Suggestions?
> 
> // clear the search criterias on load when not in a search (form 
> submitted or load page through pager)
> $listername = 'tx_hrirc_orgs_orglister';//formid + listerid
> $formname = 'orgsearchform';
> $pager = FALSE;
> $aG = t3lib_div::_GET($this->_oParent->oFormidable->formid);
> $aG = (is_array($aG) ? $aG : array());
> if (array_key_exists($listername, $aG)){
>     $lister = $aG[$listername];
>     if (array_key_exists('page', $lister)){
>         $pager = TRUE;
>     }
> }
> //debug($pager);
> 
> if (!$this->_oParent->oFormidable->oDataHandler->_isSubmitted() && !$pager)
>     $this->_oParent->oFormidable->clearSearchForm($formname);
> 
> 
> Albert van der Veen wrote:
>> Hi,
>>
>> I placed this in the meta section and seems to work. Can anyone 
>> confirm this is the right way to do it?
>>
>>         <oninit>
>>             <userobj>
>>                 <php><![CDATA[/*<?*/
>>                                // clear the search criterias on load
>>                 
>> $this->_oParent->oFormidable->clearSearchForm('pubsearchform');
>>                 //debug($_SESSION);
>>
>>                 /*?>*/]]></php>
>>             </userobj>
>>         </oninit>
>>
>>
>> Thanks,
>> Albert
>>
>> Albert van der Veen wrote:
>>> Hi all,
>>>
>>> I thought this question had been posted before, but can't seem to 
>>> find an answer: I want to clear the form when the page with 
>>> searchform loads. I presume the method clearFilters() in 
>>> rdtsearchform should be used somewhere. Anyone have an example of 
>>> where and how to use it?
>>>
>>> thanks,
>>> Albert


More information about the TYPO3-project-formidable mailing list