Jump to content


ceheAdam

Member Since 27 Feb 2017
Offline Last Active Mar 09 2017 09:31 PM
-----

Topics I've Started

Populate a dropdown based on another dropdown

27 February 2017 - 06: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.