⚠ In case you've missed it we are migrating 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 forum is read-only and soon will be archived. ⚠


Member Since 22 Nov 2012
Offline Last Active Jan 12 2013 09:04 PM

Topics I've Started

Trying to implement the library for interdependent select lists

13 December 2012 - 03:48 PM


I am trying to do just as it is written on the library, and I have an identical case, countries, states and cities and another table, so it should be straightforward, yet .. I am not coming on :wacko:

I have the 3 tables:




then I have another table called attributes which has, as foreign keys, the primary keys of each of these 3 tables, id_country, id_region, id_town

Then the names of the dropdowns are:

countries, for countries

regions, for regions

towns for cities

And also the tables for countries states and cites are interrelated the same way that it is shown in the library.

I have then the following code:

  $crud->set_relation('id_country', 'country', 'name_country'); 
  $crud->set_relation('id_region', 'regions', 'name_region');  
  $crud->set_relation('id_town', 'towns', 'name_town'); 
  $fields = array(
  // first field:
    'countries' => array( // first dropdown name
	  'table_name' => 'countries', // table of country
	  'title' => 'name_country', // country title
	  'relate' => null // the first dropdown hasn't a relation
    // second field
    'regions' => array( // second dropdown name
	  'table_name' => 'regions', // table of state
	  'title' => 'name_region', // state title
	  'id_field' => 'id_region', // table of state: primary key
	  'relate' => 'id_country', // table of state: id_pais es la foreign key de paises
	  'data-placeholder' => 'select state' //dropdown's data-placeholder:
    // third field. same settings
    'towns' => array(
	  'table_name' => 'towns',
	  'order_by'=>"name_town DESC",  // string. It's an optional parameter.
	  'title' => 'id: {id_town} / city : {name_town}',  // now you can use this format )))
	  'id_field' => 'id_town',
	  'relate' => 'id_region',
	  'data-placeholder' => 'select city'
  $config = array(
    'main_table' => 'atributes',
    'main_table_primary' => 'id_atribut',
    #"url" => base_url() . __CLASS__ . '/' . __FUNCTION__ . '/', 'atributos_Copy'/'atributs_code'
    "url" =>base_url() . '__atributos_Copia__' .'/' .'__atributos_codigo__'. '/',
  $categories = new gc_dependent_select($crud, $fields, $config);

  //$output = $categories->render();
  // the second method:
  $js = $categories->get_js();
  $output->output.= $js;

I am not sure if I have interpreted the sample correctly, but what happens is that when I click on the pencil for example to update the data, it takes 3 minutes to open the panel and the select lists are not interconnected, if I move one, the other doesnt notice, also the text editor is gone, there is no formatting headers etc, so the page is very much screwed, I dont know if I have to replace the "main_table" and "table_name" by the actual name of MY tables, but I did that and made no difference.

The editor for Medium Text features are gone

06 December 2012 - 09:52 AM


I suspect the reason is that FTP program makes mistakes when uploading files, sometimes it misses one out of some thousands, and you are screwed as you don't know why.

so I decided to delete everything and redo. It worked.

Thank you




In one of the panels I created everything worked well, the fields that in the table were set as Medium Text, would show up in the panel as a large text field with all the smilies,and formatting icons, you know the tiny_mce etc

I have reproduced the exact same files in another web, and I am not getting the formatting icons, only an empty text field. Why is that? where is that that controls that?

I have the most basic configuration and I am only using one table in the db

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Al_panel_c extends CI_Controller {

function __construct()


public function index()

public function content()
$crud = new grocery_CRUD();

# ++++++++++++++++ LOAD IMAGES RESIZING ++++++++++++++++++++++++++++++++++++

$crud->set_field_upload('pic1','images'); #
$crud->set_field_upload('pic2','images'); #
$crud->set_field_upload('pic3','images'); #
$crud->set_field_upload('pic4','images'); #
$crud->set_field_upload('pic5','images'); #

$crud->callback_after_upload(array($this,'resize')); #

$output = $crud->render();



function resize($uploader_response,$field_info, $files_to_upload)

$thumb_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;


if($this->image_moo->error) {

print $this->image_moo->display_errors();

return true;


function _example_output($output = null)



In addition I am finding out that the Save and go back to list is not working.
The Save button does save, but after that, instead of the green message your data has been added ..i get an ugly unformatted message saying the same thing.

something really weird is going on here...

callback function

04 December 2012 - 02:51 PM

Hello everybody,

I am confronted with the following.

I have interdependent select lists in my webform and they work fine with JQUERY

but now, I need the same utility in the CRUD panel.

I dont know how to go about that.

I am thinking about using a callback function.., that is, when I select the first option from the first select list, then according to that previous selection, the second select lists, populates. Like I said, it works on the users interface on the web, but...how do I do that in the CRUD panel?

thank you

Different users login in?

22 November 2012 - 08:54 AM


Would it be possible that the administration panel, where the table and rows are can have access for different users and each user just gets his own table that he can modify?

That is, what we have now is an administration page, a CRUD page where we can upload pictures, write text etc, but only for me. The scenario is that you have a website and you let other people log in, each with their different account and each of them would have access to only their own table with their own data. Of course, all can log at the same time from different places in the world.

I can imagine of course that that would be a matter of session_id, where each user gets his, and with that session_id then the specific data are retrieved for each user, I am imagining all this, but is it really feasible or it would be too difficult to do with CRUD ?