hide list options with condition

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

hide list options with condition

Post by iggabz »

Good day,

either of the two are working fine
$this->ListOptions["view"]->Visible = false; at ListOptions_Load
or this
$this->ListOptions->Items["edit"]->Body = ""; at ListOptions_Rendered

but when i add condition like this

 if ($this->action->CurrentValue == "New") {
    $this->ListOptions->Items["edit"]->Body = "";
}

it shows and error "Attempt to read property "CurrentValue" on null"


arbei
User
Posts: 9437

Post by arbei »

  1. The error means that $this->action is null, you better check the field variable name, see Database, Table and Field Variable Names.
  2. Also, there is no field values yet in ListOptions_Load.

iggabz
User
Posts: 94

Post by iggabz »

thank you


iggabz
User
Posts: 94

Post by iggabz »

if ($this->_action->CurrentValue == "Processing" && ($_SESSION['CurrentUserID'] == $this->received_by->CurrentValue)) {
    $this->ListOptions->Items["edit"]->Body = "";
}

is this possible?


mobhar
User
Posts: 11767

Post by mobhar »

In which server event did you put that code?


iggabz
User
Posts: 94

Post by iggabz »

table specific > list page > ListOptions_Rendered


mobhar
User
Posts: 11767

Post by mobhar »

Then it is possible.


iggabz
User
Posts: 94

Post by iggabz »

thank you.


Post Reply