[TYPO3-project-formidable] Clear search form

Albert van der Veen albert.van.der.veen at xs4all.nl
Fri May 9 13:21:51 CEST 2008


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