Hi guys!
I'm working on an application with Grocery Crud & CodeIgniter, and so far all the docs, tutorials & questions on this forum helped me. But now, i can't figure what to do for my current problem.
I've got the following action in my controller :
function getClausesRelations($id) { session_start(); $_SESSION['first_id'] = $id; $crud = new grocery_CRUD(); $crud->set_theme('datatables'); $crud->set_table('clause_clauses') ->set_subject('Clauses Relations') ->columns('id', 'name', 'type') ->display_as('id', 'Clause Id') ->display_as('name', 'Clause Name') ->display_as('type', 'Type of Relation'); $crud->set_model('mymodel'); $crud->fields('name', 'type'); $crud->required_fields('type'); $crud->callback_edit_field('name', array($this, 'getClauseName')); $crud->callback_delete(array($this, 'deleteClauseRelations')); $crud->basic_model->set_query_str("SELECT C2.id, C2.name, CC.type FROM clauses C1, clauses C2, clause_clauses CC WHERE C1.id = " . $id . " AND C1.id IN (CC.clause_id, CC.related_clause_id) AND C2.id IN (CC.clause_id, CC.related_clause_id) AND C2.id != C1.id ORDER BY C2.id; "); session_destroy(); $output = $crud->render(); $this->output($output); }
The fact is that the column/field 'type' is an enum with 2 values (Exclusion/Involvement), and when i want to edit an existing object from my database(Image 1)[spoiler],[/spoiler] the enum field has no default value, and I wish the selected value by default was the value from the dabase (In this Case, Involvement should be the selected default value, and not an empty field)
[spoiler][/spoiler]
I hope you will be able to help me, and sorry for my (bad) english!