⚠ 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 Dropdowns



troyv
  • profile picture
  • Member

Posted 09 October 2020 - 11:29 AM

I'm using Victor's Dependent dropdown. Is it possible to have 2 dependent dropdowns with same first field

 

 

$fields = array(
 
// first field:
'gender_issue_type' => array( // first dropdown name
'table_name' => 'ref_gender_issue', // table of country
//'where' =>"ind='1'",  // string. It's an optional parameter.
'title' => 'gender_issue', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'goal' => array( // second dropdown name
'table_name' => 'ref_goal', // table of state
//'where' =>"ind='1'",  // string. It's an optional parameter.
'title' => 'goal', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'gender_issue_id', // table of state:
'data-placeholder' => 'Select Goal' //dropdown's data-placeholder:
 
),
// third field. same settings
'objective' => array(
'table_name' => 'ref_objective',
//'where' =>"ind='1'",  // string. It's an optional parameter.
//'order_by'=>"state_title DESC",  // string. It's an optional parameter.
'title' => 'objective',//'id: {city_id} / city : {city_title}',  // now you can use this format )))
'id_field' => 'id',
'relate' => 'goal_id',
'data-placeholder' => 'Select Objective'
)
 
 
 
 
);
 
$config = array(
'main_table' => 'tbl_plan',
'main_table_primary' => 'id',
"url" => "",//base_url() . __CLASS__ . '/' . __FUNCTION__ . '/', path to method
'ajax_loader' => base_url().'assets/images/' . 'ajax-loader.gif' // path to ajax-loader image. It's an optional parameter
 
);
 
 
 
$categories = new gc_dependent_select($crud, $fields, $config);
$js = $categories->get_js();
 
 
$fields2 = array(
 
// first field:
'gender_issue_type' => array( // first dropdown name
'table_name' => 'ref_gender_issue', // table of country
//'where' =>"ind='1'",  // string. It's an optional parameter.
'title' => 'gender_issue', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'gad_issue_mandate' => array( // second dropdown name
'table_name' => 'ref_gender_issue', // table of state
'title' => 'gad_issue_mandate', // state title
'id_field' => 'id', // table of state: primary key
'relate' => 'gender_issue_id', // table of state:
'data-placeholder' => 'Select Gender Issue/ GAD Mandate' //dropdown's data-placeholder:
 
)
 
 
);
 
 
 
 
 
 
 
 
 
 
$config2 = array(
'main_table' => 'tbl_plan',
'main_table_primary' => 'id',
"url" => "",//base_url() . __CLASS__ . '/' . __FUNCTION__ . '/', path to method
'ajax_loader' => base_url().'assets/images/' . 'ajax-loader.gif' // path to ajax-loader image. It's an optional parameter
);
 
Thanks in advance :)
 
 
 
 
$categories2 = new gc_dependent_select($crud, $fields2, $config2);
$js2 = $categories2->get_js();

 


deanagage
  • profile picture
  • Member

Posted 12 April 2021 - 08:06 AM

I have the same question (and I'm sure I'm not alone). Why has nobody replied to the original question?