This topic is locked

Change search options

1/8/2007 6:46:51 AM
PHPRunner General questions
P
ploppy author

I need to change the default search results. at the moment, if a user presses the submit button with no input, it displays all entries, similar to 'show all' function. I would like to change this so that no entries are displayed. i have checked the file jsfunctions.js, but cannot be sure what code to change. would appreciate comments how to do this? Thanks.

J
Jane 1/8/2007

Hi,
To display No records found on the list page first check off No records on the first page option on the Edit SQL query tab.

Unfortunately it's impossible to use this option for the Search button.

P
ploppy author 1/8/2007

hi jane. thanks for reply. I have done that. That option only disables the list being displayed when the page loads. I am sure there is some code that can be inserted to display no records found if the customer inputs no query? in my case, i need a user to search for there results and not just press the search button and have all results displayed. Thanks. peter

J
Jane 1/9/2007

Hi,
you can do it editing generated files manually.

Open ..._list.php file, find following lines:

if(postvalue("SearchFor")!="" || postvalue("SearchOption")=='Empty')

$_SESSION[$strTableName."_search"]=1;

else

$_SESSION[$strTableName."_search"]=0;



and replace it with this one:

if(postvalue("SearchFor")!="" || postvalue("SearchOption")=='Empty')

$_SESSION[$strTableName."_search"]=1;

else

$_SESSION[$strTableName."_search"]=1;



Then find this code snippet:

if(@$_SESSION[$strTableName."_search"]==1)

// regular search



and replace it with this one:

if(@$_SESSION[$strTableName."_search"]==1 && trim($_SESSION[$strTableName."_searchfor"])=="" && $_SESSION[$strTableName."_searchoption"]!="Empty")

$strSQL = AddWhere($strSQL,"1=0");

elseif(@$_SESSION[$strTableName."_search"]==1)

// regular search