⚠ 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

dependant dropdown box



akhil
  • profile picture
  • Member

Posted 08 June 2015 - 06:07 AM

while using dependant dropdown library, some error occuring during editing the select box data. also success message could n't happen


Paul Savostin
  • profile picture
  • Member

Posted 08 June 2015 - 09:47 AM

Hi! Can you get more explanation, example code and so on? Cause i can get you the same answer - something goes wrong...


akhil
  • profile picture
  • Member

Posted 08 June 2015 - 12:17 PM

I am use  ajax_grocery_crud library for dependent drop-down box. After updating the data, there is no success message has been occuring. and also the validation messages stay there. The problem only happens while editing the data.

Please help me.


Paul Savostin
  • profile picture
  • Member

Posted 08 June 2015 - 13:45 PM

Never heard about ajax_grocery_crud library. I am using /topic/1087-updated-24112012-dependent-dropdown-library/ written by Victor.

 

And all works perfectly for me, thanks to Victor.

In any case you need to use debugging tools to see any problems and errors. In Firefox I using - Webdeveloper tools, Firebug, Firephp.

I cant and nobody cant help you if you dont write some code or pictures with errors, at least requests using this debug tools while you click edit.


akhil
  • profile picture
  • Member

Posted 09 June 2015 - 03:44 AM

Thank you paul, Let me try the victor's library.


akhil
  • profile picture
  • Member

Posted 09 June 2015 - 04:28 AM

When i am using victor's library a problem happens while adding the data. updating process is going well.i can't add dropdown field. i hereby post my code

public function district()
{
$crud = new grocery_CRUD();
$crud->set_table('district');
$crud->set_relation('country_name', 'country', 'country');
$crud->set_relation('state_name', 'state', 'state_name');
$crud->required_fields("state_name","country_name","district_name");
$this->load->library('gc_dependent_select');
$fields = array(
 
// first field:
'country_name' => array( // first dropdown name
'table_name' => 'country', // table of country
'title' => 'country', // country title
'relate' => null // the first dropdown hasn't a relation
),
// second field
'state_name' => array( // second dropdown name
'table_name' => 'state', // table of state
'title' => 'state_name', // state title
'id_field' => 'state_id', // table of state: primary key
'relate' => 'country_name', // table of state:
'data-placeholder' => 'select state' //dropdown's data-placeholder:
 
)
);
$config = array(
'main_table' => 'district',
'main_table_primary' => 'district_id',
"url" => base_url() . __CLASS__ . '/' . __FUNCTION__ . '/', //path to method
//'ajax_loader' => base_url() . 'ajax-loader.gif', // path to ajax-loader image. It's an optional parameter
//'segment_name' =>'Your_segment_name' // It's an optional parameter. by default "get_items"
);
$categories = new gc_dependent_select($crud, $fields, $config);
$js = $categories->get_js();
$output = $crud->render();
$output->output.= $js;
$this->output($output);
 
}
 
please help me.

Paul Savostin
  • profile picture
  • Member

Posted 09 June 2015 - 09:04 AM

Hi! Correct me if i am wrong - why in your relation you using country_name instead country_id ? The same in second relation - state_name instead state_id ?

I told you - teach yourself to debugging while development proccess!

And you will see possible errors.


akhil
  • profile picture
  • Member

Posted 10 June 2015 - 05:28 AM

Actually country_name contains the value contry_id

 

for example,

country="india"

id="1"

 

then my country_name=1


Paul Savostin
  • profile picture
  • Member

Posted 10 June 2015 - 10:47 AM

Why your relate field named like country_name or state_name ??? did you know country with name "1" ? This is wrong man... and confusing all around believe me

In any case you need find error place, try to debug and show here requests from Firebug! Dont you understand that we here like blind, man?
 


akhil
  • profile picture
  • Member

Posted 10 June 2015 - 11:48 AM

thank you for your valid information. let me see 

thanks


akhil
  • profile picture
  • Member

Posted 12 June 2015 - 11:05 AM

I am totally tired. I couldn't get the result. What can i do. Will you please give an explanation with an example?


Paul Savostin
  • profile picture
  • Member

Posted 12 June 2015 - 13:03 PM

all you can find at link that I gave you