⚠ 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

Populate a dropdown based on another dropdown



ceheAdam
  • profile picture
  • Member

Posted 27 February 2017 - 18:46 PM

I have an application that allows users to upload media assets and put them in categories and subcategories.

 

Currently if I select a category, it shows all the subcategories available. I want to have the first dropdown (categories) determine what is shown in the second dropdown (subcategories). 

 

I have two relations set up already to display the category and subcategory names.

 

Here is what I am using to display the table.

$subject = 'creative library Assets';
        
        

        $this->crud->set_subject($subject);
        
        $this->crud->unset_columns('date_added','date_modified');
        $this->crud->unset_read();
        
        
        $this->crud->set_relation('category_id','creative_library_categories','category_name');
        $this->crud->set_relation('college_id','college','college_name');
        $this->crud->field_type('date_added', 'hidden');
        $this->crud->field_type('date_added', 'hidden');
        $this->crud->field_type('date_modified', 'hidden');
        $this->crud->set_field_upload('asset','assets/uploads/files');
        $this->crud->set_field_upload('thumbnail','assets/uploads/files');
        $this->crud->unset_texteditor('asset_title');
        
        
        
         $this->_render($subject, 'creative_library');

Any insight would be greatly appreciated.


xheradon
  • profile picture
  • Member

Posted 02 March 2017 - 13:00 PM

Try this dependant dropdown library /topic/1087-updated-24112012-dependent-dropdown-library/


ceheAdam
  • profile picture
  • Member

Posted 08 March 2017 - 18:25 PM

Try this dependant dropdown library /topic/1087-updated-24112012-dependent-dropdown-library/

 

The categories and subcategories are in the same table. I don't think that library works for me. I am keeping a copy if it for other projects though.


xheradon
  • profile picture
  • Member

Posted 09 March 2017 - 07:38 AM

Despite of being in the same table, I suppose the relations are in other tables?