This topic is locked

hideField

1/22/2019 3:49:42 AM
PHPRunner General questions
Tandy author

I am trying to hide two fields in the edit page.

I have been trying to use the code at this page: https://xlinesoft.com/phprunner/docs/hide_controls_on_add_edit_pages.htm

But my code does not seem to work?I am using static permissionsI have in usertype: default, admin, and userI also have admin checked off as Admin Group (Can See and Edit all Records)
The code I have listed on before display is:
if (Security::isAdmin())

$pageObject->hideField("usertype");

$pageObject->hideField("truck_number");

AS admin and as a user both usertype and truck_number show up and can be edited?Am I missing something?
Any help on this would be great..Thank You.James Tandy

admin 1/22/2019

You need to make sure that field name spelling is correct (case sensitive).
Before playing with Security API you need to make sure this code works without first line i.e. simply use

$pageObject->hideField("usertype");

$pageObject->hideField("truck_number");



to make sure fields are being hidden.

Tandy author 1/23/2019

Yes they are both hidden from all with this:$pageObject->hideField("usertype");$pageObject->hideField("truck_number");
But when I have it like this:if (Security::isAdmin())$pageObject->hideField("usertype");

$pageObject->hideField("truck_number");
Then under admin usertype shows up but not truck_numbersame with a normal user.
Then if I do this:if (Security::isAdmin())$pageObject->hideField("usertype");

if (Security::isAdmin())

$pageObject->hideField("truck_number");

They both show back up for everyone.
It is almost like admin is not admin. I have under GroupID Field: usertype and in that I have: default, admin, user. All lowercase.

Then under admin I also have it checked as admin below the Static Permissions?

Thank you for helping..James Tandy