Hide Edit option to record on list page base on condition

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
christ2000
User
Posts: 519

Hide Edit option to record on list page base on condition

Post by christ2000 »

Hello i am trying to figured out how hide the edit button on list page for certain records if a condition is true , the code i am using on Page Render event is:

    if ($this->approved->CurrentValue == 1) { 
    
    $this->OtherOptions["action"]->Items["edit"]->Visible = false;
}

but it is not working. any idea if there any solution for this?

thanks


mobhar
User
Posts: 11660

Post by mobhar »

Edit button on List page is part of ListOptions object. It is not part of OtherOptions object.

In addition, you should use ListOptions_Rendered server event, not Page_Render.

So, your code should be:

if ($this->approved->CurrentValue == 1)
    $this->ListOptions["edit"]->Body = "";

christ2000
User
Posts: 519

Post by christ2000 »

Perfect solution, thanks!!!


Post Reply