Requires search criteria option selection dynamically

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
anil
User
Posts: 24

Requires search criteria option selection dynamically

Post by anil »

Hi,
How can I enable "Requires search criteria" option dynamically based on login through code. When admin is logged in, disable this option. For all other users, this option is to be enabled.


mobhar
User
Posts: 11660

Post by mobhar »

  1. Make sure you DO NOT enable "Requires search criteria" from "Table" setup,

  2. Then, simply put the following code in "Recordset_Selecting" server event:

if (IsAdmin()) { // if admin user
// do nothing, it means display all records by default; disable requires search criteria
} else { // if not admin user, then enable requires search criteria below ...
if ($filter == "") {
$filter = "0=101";
$this->SearchWhere = $filter;
$this->setSessionWhere($filter);
$this->CurrentFilter = "";
}
}

  1. Regenerate ALL the script files again, and enjoy the result.

Post Reply