⚠ 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

dependent select



maru
  • profile picture
  • Member

Posted 24 January 2013 - 02:25 AM

Hi!

I have this code for my products


function products_v()
{

try{

$crud = new grocery_CRUD();

$crud->set_theme('datatables');

$crud->set_table('products');

$crud->set_subject('Products');

$crud->required_fields(
'id',
'name',
'category',
'subcategory'
);

$crud->columns(
'id',
'name',
'category',
'subcategory'
'price',
'active',
'image'
);

$crud->set_relation('id_category', 'category', 'name_category');
$crud->set_relation('id_subcategory', 'subcategory', 'name_subcategory');


$crud->set_field_upload('image','images/products');


$output = $crud->render();

$this->load->view('products_v', $output);

}


It's working ok, but I would like to know how can I do when I choose a category, the other select (subcategory) just show subcategories from the same category.

Ex.
Category: Wine

Subcategory:
- Red
- White
- Rosé

Hope can help me, thanks in advance!

maru
  • profile picture
  • Member

Posted 29 January 2013 - 00:03 AM

I found the solution in this forum :)
Here it is /topic/1087-updated-24112012-dependent-dropdown-library/ maybe can be helpful to someone else.

And special mention for Victor, who share that amazing library.

Regards!