Hi,
I got my n_n relation working like a charm:
http://i.imgur.com/DmhviZD.png
My "problem" is that I want to use the other form control, like demonstrated in the example here:
http://i.imgur.com/dDAaK28.png
(http://www.grocerycrud.com/documentation/options_functions/set_relation_n_n)
How go I go on about this?
My code:
$crud = new grocery_CRUD();
$crud->set_table('users')
->set_subject('User')
->columns('username','id', 'email', 'active')
->display_as('username','Username')
->display_as('id','Id')
->display_as('email','Email')
->display_as('active','Active');
$crud->callback_before_delete(array($this,'protect_default'));
$crud->callback_before_insert(array($this,'encrypt_password_callback'));
$crud->callback_before_update(array($this,'encrypt_password_callback'));
$crud->callback_edit_field('password',array($this,'set_password_input_to_empty'));
$crud->callback_add_field('password',array($this,'set_password_input_to_empty'));
$crud->field_type('salt', 'hidden');
$crud->set_relation_n_n('groups', 'user_group_relations', 'usergroups', 'user_id', 'group_id', 'name');
$crud->set_rules('username', 'Username', 'trim|required|min_length[3]|max_length[12]|xss_clean');
$crud->set_rules('email', 'Email', 'required|valid_email');
$crud->unset_print();
$crud->unset_export();
$crud->unset_delete();
$crud->fields('username', 'email','groups', 'active', 'password', 'salt');
$crud->required_fields('username', 'email', 'active');
