⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠


profile picture

How bring combobox already selected in 'add' crud option ?

Bart Reis

Bart Reis
  • profile picture
  • Member

Posted 09 November 2013 - 12:14 PM

I have a normal CRUD, 

    public function finalidadeAnimal() {
        $output = $this->grocery_crud->render();
        $this->load->view('our_template.php', $output);

But i want that every time i click in a anchor like this :

anchor('/cruds/finalidadeanimal/add/param_animal_id/1', 'Click Here', 'target="_blank"'));

I want to bring the animal's combobox selected with the parameter, in this case is the number 1.


How could i do that in ADD option ????




  • profile picture
  • Member

Posted 10 November 2013 - 07:00 AM

Hello and welcome to the forums [member=bart reis].

I am not sure what exactly you try to do but this anchor('/cruds/finalidadeanimal/add/param_animal_id/1'

won't work because you try to pass this parameter after the add function which is an internal function of the Grocery Crud library.

If you have to do this, you need to change the core of the library which I advice not to do it.


If you need to pass some parameter during add try to use the field_type function with the default value.

But remember that this only works hidden, enum and set fields.