$crud->columns('key', 'value','type'); $crud->required_fields('value'); if ($crud->getState() == 'edit') { $field_id = $this->uri->segment(5); $_SESSION['field_id'] = $field_id; $field = $this->fields->get($field_id); $field_type = $this->field_types->get($field['field_type']); $field_type = $field_type['type']; $crud->fields('value'); if ($field_type == 'file') { $crud->set_field_upload('value'); $crud->callback_before_upload(array($this, '_callback_upload_image')); } }
how to set upload field dynamically on condition that a field has some specific value
- Single Page
Posted 14 January 2017 - 00:04 AM
Posted 18 January 2017 - 02:20 AM
Hi EHMAD
There is a catch i believe to the grocery crud - for you to be able to set a field as upload, you need to have the same as a field in the table. If you dont, it wont set it as upload. Do you have a value field available in the table? if not, i will recommend you add the same.. and check.