Warning: Creating default object from empty value

Hi everyone,I’m tried to use “ReadOnly” function on a server script. But a Warning appears and doesn’t work.

// Table Permission Loaded event
function TablePermission_Loaded()
{
    //Log("Table Permission Loaded: " . $this->CurrentUserLevel);
    if (CurrentUserName() == "xxx" && CurrentTable()->TableName == "xxx")
         $this->setCanEdit(true);
         $this->FieldName->ReadOnly = TRUE;
}

setCanEdit(true); THIS it works fine, the problem it’s readonly function.This is the warning: Warning: Creating default object from empty value in D:\xxx\xxx\xxx\xxx\src\AdvancedSecurity.php on line 1305Someone can helpme?

Try to change this code:
$this->FieldName->ReadOnly = TRUE;to:
Container(“tablename”)->yourfieldname->ReadOnly = true;PS: Change tablename to your actual table name, and change yourfieldname to your actual field name.

Hi,I tried your code, but didn’t work. Something else for this?

You may post your code for discussion. Also make sure your table and field variable names in your code are correct, read Database, Table and Field Variable Names.