This topic is locked
[SOLVED]

 Access Search String in List page event

11/29/2017 6:17:28 PM
PHPRunner General questions
T
thamestrader author

Does anyone have any thoughts as to how I can access the variables or parameters on the webpage 'address' line please?
I want to put code in the JSONLOAD event that can take different actions based on the absence or presence of variables after the xxxxxx.php filename.

......fb_person_list.php - this is an example without variables when the list page is loaded from the menu
The three examples below are when a search has been done using the search field in the standard search bar on the list page.



......fb_person_list.php?qs=b

......fb_person_list.php?qs=b&criteria=or

......fb_person_list.php?qs=Dibnah&criteria=or

I'm not bothered about the actual variable values - just whether or not there is something after the .php.
I have tried $_SERVER["QUERY_STRING"] in BeforeDisplay event to set a proxy variable to display in an alert in JSONLOAD, I've tried the same in the Server and After Client tabs of a custom button on the page. In both cases it shows NULL.
I've also tried $_GET['qs'], $_REQUEST["field1"] in both SeforeDisplay and Server tab of custom button - again nothing is returned.
I tried this code from the PHP manual in the server tab of a custom button on the list page - it didn't do anything either

global $strTableName;

if (isset($_SESSION[$strTableName.'_advsearch']))

{

$searchClauseObj = unserialize($_SESSION[$strTableName.'_advsearch']);

}

echo $searchClauseObj->_where[$searchClauseObj->sessionPrefix."_simpleSrch"];
I've trawled the Forum for ideas and nothing I've tried has worked, so I must be doing something wrong as both these methods have been described in Forum posts as successful.
Thanks

admin 11/30/2017

$_SERVER['QUERY_STRING'] should work and normally returns everything after a question sign.

Y
YCH 11/30/2017



$_SERVER['QUERY_STRING'] should work and normally returns everything after a question sign.


$_SERVER['QUERY_STRING'] is not documented in the manual ?

I made request in "search" but nothing showed.

admin 11/30/2017

Yes, because is has nothing to do with PHPRunner. This is a PHP feature, Google it.

Y
YCH 11/30/2017



Yes, because is has nothing to do with PHPRunner. This is a PHP feature, Google it.


All right. Thanks. Learning...

T
thamestrader author 11/30/2017



$_SERVER['QUERY_STRING'] should work and normally returns everything after a question sign.


Thanks Sergey.
I tried it on my List page and it only returned data if I used advanced search, but this page uses a custom view and the pages have been edited to remove some standard fields plus it has event code. I then tried it on a table list page that has not been modified and it worked perfectly returning data for Advanced Search, Basic Search and the simplecombosearch fields.
So I now know that the problem is with the custom view List page - so I'm going to RESET the page and try the $_SERVER['QUERY_STRING'] prior to any editing and removing the simplecombosearch fieldname and fieldtype controls.

T
thamestrader author 11/30/2017



I tried it on my List page and it only returned data if I used advanced search, but this page uses a custom view and the pages have been edited to remove some standard fields plus it has event code. I then tried it on a table list page that has not been modified and it worked perfectly returning data for Advanced Search, Basic Search and the simplecombosearch fields.
So I now know that the problem is with the custom view List page - so I'm going to RESET the page and try the $_SERVER['QUERY_STRING'] prior to any editing and removing the simplecombosearch fieldname and fieldtype controls.


I think I've identified the cause......
Its to do with the AJAX Search, Pagination and Sorting option on the list page settings. If this is ticked then the ['QUERY_STRING'] only returns data when the Advanced Search is used. If it is unchecked then ['QUERY_STRING'] returns data from basic search, search panel and Advanced Search.