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.
Requires search criteria option selection dynamically
-
- User
- Posts: 24
Requires search criteria option selection dynamically
-
- User
- Posts: 11726
Make sure you DO NOT enable "Requires search criteria" from "Table" setup,
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 = "";
}
}
- Regenerate ALL the script files again, and enjoy the result.