I'm having an issue where I want to insert a record when using a relation and a where statement. What I am looking for is to have the primary key of the related field to be inserted into the child table. For example (and yes, the db conventions are terrible, legacy database)
function member_branches(){
$crud = new grocery_CRUD();
$crud->set_model('mssql_Grocery_Model');
$crud->set_theme('datatables');
$crud->set_table('Branch');
$crud->set_subject('Member Firm Branch Office');
$crud->columns('BranchName', 'Address1', 'City', 'State');
$crud->set_relation('MemberID', 'Members', 'Name');
$crud->edit_fields('BranchName', 'Address1', 'Address2', 'City', 'State', 'Zip', 'Phone', 'Fax');
$crud->add_fields('MemberID', 'BranchName', 'Address1', 'Address2', 'City', 'State', 'Zip', 'Phone', 'Fax');
$where = $this->uri->segment(3, 0);
$crud->where('Branch.MemberID',$where, FALSE);
$output = $crud->render();
$this->_members_output($output);
}
So, in this case, I am looking for the MemberID on add_fields to be populated with the $where uri segment. This seems like it would be a standard problem/issue. If I use MemberID in the add_fields then a dropdown is available, which defaults to the first entry, if I do not add it (which is what I want, no client side ability to modify) then it does not get populated.
Ideas?
Happy Holidays!