Is there a way to make a field readonly in the edit screen only when there is a value already entered, and if blank or "0000-00-00 00:00:00" then the user is able to enter a date? The code below is not working, once I hit Update the "Loading, updating changes..." just runs in a loop and will not execute. I think the callback_before_update is probably not the right way of doing this.
$crud->callback_before_update(array($this,'check_Original_ETA'));
function check_Original_ETA($value, $primary_key)
{
$this -> db -> select('Original_ETA');
$this -> db -> from('dbname');
$this -> db -> where('id = ' . "'" . $primary_key . "'");
$this -> db -> limit(1);
$query = $this -> db -> get();
$row = $query->row();
//$query->result();
$str = $row->Original_ETA;
if ($str != '0000-00-00 00:00:00')
{
$crud->change_field_type('Original_ETA', 'readonly');
}
}
