MySQL Error with Multi Form Field

edited August 2016 in Modules
Hi,

I'm adding a multi form field to a simple module of mine (a news module which was created by FUEL CMS). When I submit the form, I get the following MySQL error because of the multi form field:
A Database Error Occurred Error Number: 1054 Unknown column 'Array' in 'field list'

Upon further inspection, it seems that the multi form field's data is being passed as an array object into SQL. Why is this? Here's how I set up my multi form field:
function form_fields($values = array(), $related = array()) { $fields = parent::form_fields($values, $related); $attorneys = fuel_model('attorneys', array('select' => 'slug, name_f, name_m, name_l', 'order'=>'name_l ASC')); $n = array(); foreach($attorneys as $at){ $n[$at->slug] = $at->name_f.' '.$at->name_m.' '.$at->name_l; } // put in your own specific code to manipulate the fields here $fields['hook'] = array( 'display_label' => TRUE, 'required' => FALSE, 'type' => 'multi', 'options' => $n, ); return $fields; }

Is there something I have to do in processing the field data to parse it into MySQL and insert it into the database?
The column in my database is just set to TEXT. I'm not sure if there's a specific type used for multi form fields. Does it serialize the data like repeatable form fields do?

Thanks!

Comments

Sign In or Register to comment.