Hi
Using V2023 .13 (getting the upgrade for xmas)
I want to hide a field based on user level
Admin -1
Anonymous -2
Default 0
Project Users 1
and i want to hide for anno only (so anyone not logged in) so tried this
// Page Load event
function Page_Load()
{
if ($this->CurrentUserLevelID == -2 ) {
$this->Description->Visible = FALSE;
}
}
Whilst I don’t get any errors the field is visible logged in or not ?
Help Appreciated
John B
try in the list page…
// Page Render event
function Page_Render()
{
$this->FIELDNAME->Visible = false;
}
Hi
Thanks just to be clear I add the page render code in addition to the page load code ?
John B
Hi
I have this on the pageload
{
if ($this->CurrentUserLevelID == -2 ) {
$this->Description->Visible = FALSE;
}
and as suggested this on page render
$this->Description->Visible = FALSE;
No errors but logged in or not the field is always visible - any thoughts really appreciated.
Kind Regards
John B
add the code to the Page_Render() of the form you are trying to hide the item in, doesn’t matter if its the edit/add/view forms… add it to the page_render() event
sample, this is from one of my list pages:
// Page Render event
function Page_Render()
{
global $Security;
if(!$Security->IsSysAdmin()) {
$this->OtherOptions['action']->Items['multiupdate']->Clear();
$this->is_sys_default->Visible = false;
}
}
sample, this is from one of my view pages
// Page Render event
function Page_Render()
{
global $Security;
if($allowEncryption <= 0) {
$this->DocumentEncryptionStatus->Visible = false;
$this->DocumentEncryptObject->Visible = false;
$this->encryption_key->Visible = false;
}
}
}
in your function try it this way
// Page Render event
function Page_Render() {
global $Security;
if($Security->CurrentUserLevelID == -2 )
$this->Description->Visible = false;
}