Jump to content


Populate a dropdown based on another dropdown

dropdown

  • Please log in to reply
3 replies to this topic

#1 ceheAdam

ceheAdam

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 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.



#2 xheradon

xheradon

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationSpain

Posted 02 March 2017 - 01:00 PM

Try this dependant dropdown library http://www.grocerycr...opdown-library/



#3 ceheAdam

ceheAdam

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 08 March 2017 - 06:25 PM

Try this dependant dropdown library http://www.grocerycr...opdown-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.



#4 xheradon

xheradon

    Advanced Member

  • Members
  • PipPipPip
  • 47 posts
  • LocationSpain

Posted 09 March 2017 - 07:38 AM

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







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users