How do I check if the field Original_Time is null?
$crud->callback_before_update(array($this,'check_Original_ETA'));
function check_Original_ETA($value, $primary_key) { $this -> db -> select('Original_ETA'); $this -> db -> from('table'); $this -> db -> where('id = ' . "'" . $primary_key . "'"); $this -> db -> limit(1); $query = $this -> db -> get(); $row = $query->row(); $str = $row->Original_ETA; if ($str != NULL) { $crud->change_field_type('Original_ETA', 'readonly'); } }
Code above is not working. Basically if field 'Original_Time' is already filled I don't want the user to be able to change this field again.
So I think I have two issues here. How to check for Null in DateTime and also how to set a field ReadOnly going to EDIT screen depending on a field value.
Thank you for helping.