Can't save data while using multiselect field
- Single Page
Posted 09 October 2012 - 15:13 PM
I pick two choices through multi select field, save it, and nothing happened. Only occurs through the add operation.
But I'm not encountered this problem if I save it through the update operation.
Any help would be appreciated.
Thanks,
Angga.
Posted 09 October 2012 - 22:48 PM
Do you have any errors? Can you please post some code please?
Cheers
Johnny
Posted 11 October 2012 - 08:15 AM
Here some code of it.
$queryact = $this->db->query("SELECT activities FROM act_marketing");
foreach ($queryact->result() as $row)
{
$arrAct[$row->activities] = $row->activities;
}
$crud_lokasi->field_type('activities','multiselect',$arrAct);
This error only happens when adding through the add operation. It works fine when using edit/update operation
Posted 12 October 2012 - 03:30 AM
Posted 14 October 2012 - 15:12 PM
Thanks.
Posted 16 October 2012 - 03:23 AM
insert
TypeError: data is null
flexigrid-add.js (line 44)
Posted 16 October 2012 - 03:25 AM
Posted 13 March 2016 - 18:07 PM
I have the same problem, insert form don't work when I add multiselect field.
Error message:
Error Number: 1054 Unknown column 'Array' in 'field list' INSERT INTO `curso` (`NAME`, `URL`, `DESC`, `TYPE`, `NUM`, `IMAGE`, `TEACHER`, `VALOR`, `FOR_N`, `FOR_T`, `PARC`, `DURATION_N`, `DURATION_T`, `ID_SECTION`, `STATE`, `DATE_INS`) VALUES ('a', 'a', 'a', '2', '1', '', Array, '1', '1', '1', '1', '1', '1', '', '1', '2016-03-13 10:51:30') Filename: /models/grocery_crud_model.php Line Number: 483
$query = $this->db->query('SELECT ID, NAME FROM teacher'); foreach ($query->result() as $row) { $teachers[$row->ID] = $row->NAME; } $crud->field_type('TEACHER','multiselect', $teachers);
Posted 14 March 2016 - 09:32 AM
can you put up the complete code of the function that you using for the same. Also, the callback methods.. so can look into and throw in some light if possible.
Posted 14 March 2016 - 10:26 AM
can you put up the complete code of the function that you using for the same. Also, the callback methods.. so can look into and throw in some light if possible.
Posted 15 March 2016 - 07:27 AM
$crud->field_type('TEACHER','multiselect', $teachers);
well here's where the issue is.. you have custom set the field type to multiselect. That aint relation_n_n...
thats custom field type setting. For this, what you need to do is handle the insertion or pre-insertion on your own with callback_insert / callback_before_insert
callback_insert will allow you to handle he insert on your own .. or callback_before_insert - u can set the value of the field (teacher .... if it exists) in a proper pattern which will be accepted by database.
Here .. of course you have customized the field type.. GC library is going to function absolutely the way it is written to handle the field inputs. It expects you to provide a valid input type which can be directly be handled by the library or it will expect you to handle the custom type yourself.
Happy GCing:)
Posted 16 March 2016 - 02:33 AM
Fatal error: Uncaught exception 'Exception' with message 'On the state "insert" you must have post data' in /application/libraries/Grocery_CRUD.php:3340 Stack trace: #0 /application/libraries/Grocery_CRUD.php(4561): grocery_CRUD_States->getStateInfo() #1 /application/controllers/course.php(137): Grocery_CRUD->render() #2 /application/controllers/course.php(19): course->lista() #3 [internal function]: course->index('insert') #4 /system/core/CodeIgniter.php(359): call_user_func_array(Array, Array) #5 /index.php(202): require_once('...') #6 {main} thrown in/application/libraries/Grocery_CRUD.php on line 3340
and:
Error Number: 1054 Unknown column 'Array' in 'field list' INSERT INTO `curso` (`NAME`, `URL`, `DESC`, `TYPE`, `NUM`, `IMAGE`, `TEACHER`, `VALOR`, `FOR_N`, `FOR_T`, `PARC`, `DURATION_N`, `DURATION_T`, `ID_SECTION`, `STATE`, `DATE_INS`) VALUES ('a', 'a', 'a', '2', '1', '', Array, '1', '1', '1', '1', '1', '1', '', '1', '2016-03-16 07:01:22') Filename: /models/grocery_crud_model.php Line Number: 483
Am I doing something wrong?
$crud->set_relation_n_n('TEACHERS','curso_teacher','teacher','ID_TEACHER','ID_CURSO','NAME');
Posted 17 March 2016 - 10:06 AM
Posted 18 March 2016 - 06:24 AM
exactly .. u got the solution.!!
Happy GCing :)