This topic is locked
[SOLVED]

 Hide a Field on Filter Panel

7/22/2014 7:34:41 AM
PHPRunner General questions
W
wedi author

Hello.
I'm looking for a example to hide a field on the filter panel in a special condition.

I've found something in this forum, but all for hiding a field on Add/Edit page.
What i need is to hide a field under the following condition:
When a User has signed on, i read his possible values for (eg.) FieldA from a table. FieldA is defined as "Show on Filter Panel" so the User can use it on the Filter Panel. But some User are only allowed for one value and it makes no sense to show FieldA on the Filter Panel.
I think it must be set in the "Javascript onload Event" but i have no idea how. In the "After successful login Event" i identify, how much values of FieldA a user can see and write it in a SESSION variable. When the content of the variable is 1 i want to hide FieldA on the Filter Panel.
Is this possible?

Sergey Kornilov admin 7/22/2014

Sure, this can be done.

  1. BeforeDisplay event of the List page in question. Pass the value of logged user id to Javascript event:

$pageObject->setProxyValue("username", $_SESSION["UserID"]);


2. Javascript OnLoad event of the same page. Hide FieldA filter is user is not an admin

if (proxy.username!='admin')

$("[class*=filter-FieldA-container]").hide();


Replace 'FieldA' with the actual field name. This is it.

W
wedi author 7/25/2014

Hallo Sergey - sorry for my late reply.
Your solution works great <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=75290&image=1&table=forumreplies' class='bbc_emoticon' alt=':D' />
Thank you

wedi