Page 1 of 1
Reset Search Criteria
Posted: Thu Oct 10, 2013 2:26 am
by starquest321
After I conduct a search - the filter stays until I do "show all"
What event do I have to use to do the following:
After do the search .... display the results ....but the next search will not be within the context of what was searched? Meaning:
Search ----> then clear the filter for future searches?
Re: Reset Search Criteria
Posted: Thu Oct 10, 2013 9:26 am
by mobhar
Assume you are using the Advanced Search. Find this code in your generated *srch.php file:
// Restore search settings from Session
if ($gsSearchError == "")
$this->LoadAdvancedSearch();
then simply remove it, and try again.
Re: Reset Search Criteria
Posted: Thu Oct 10, 2013 11:42 am
by starquest321
Excellent but I am using normal search. Can I update template in phpnaker?
Re: Reset Search Criteria
Posted: Thu Oct 10, 2013 12:14 pm
by mobhar
Either customizing "list-script.php" template file, or customizing the generated *list.php file, then simply remove this code:
$this->RestoreSearchParms();
and
$this->setSearchWhere($this->SearchWhere); // Save to Session
Re: Reset Search Criteria
Posted: Thu Oct 10, 2013 12:40 pm
by starquest321
I want them to make some more advanced:
In search add a button called: "retain search"
If clicked ---> then keep the search parameter values
If not checked go ahead and clear them after displaying the results.
How to add button next to search option. . .
Re: Reset Search Criteria
Posted: Thu Oct 10, 2013 12:50 pm
by mobhar
Just try it by yourself first, and post your code for discussion.
Re: Reset Search Criteria
Posted: Sat Oct 12, 2013 12:48 pm
by starquest321
I noticed that there are events for searches. Can I use those instead of customizing the template?
Re: Reset Search Criteria
Posted: Tue Oct 15, 2013 10:39 am
by danielc
You can use jQuery .val(value) to clear the search value for text box input. See api.jquery.com/val/.