This topic is locked

Hide fields based on logged in user

5/9/2025 4:22:22 PM
ASPRunner.NET General questions
M
MSchell author

Trying to figure out how to get the logged in user to use it in JavaScript On Load event to hide field

In JavaScript, how to I compare the logged in user to a user ID on the form?

G
George Kondylis 5/10/2025

To pass values to the Javascript onLoad, you need to use the setProxyValue

https://xlinesoft.com/phprunner/docs/setproxyvalue.htm

on the Before Display event do:
$pageObject->setProxyValue("proxy_user", $_SESSION["UserID"]);

Then on your Javascript onLoad event, you can

if(proxy['proxy_user'] == "External"){

pageObj.toggleItem("integrated_edit_field1", false );

}

Sergey Kornilov admin 5/10/2025

Just wanted to add that doing this on the server side might be easier:
https://xlinesoft.com/asprunnernet/docs/hidefield.htm