The following snippet is a piece of code I'm using to generate a form element to select terms from a vocabulary with multiselect turned on:
$form['followup_assignment'] = taxonomy_form($followup_vid);
$form['markup'] = array(
'#value' => 'Just some markup',
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Change'),
);
...
A multiselect form element shows up fine on the page, but at the top of the page this form is on, I get this error in a message:
warning: implode() [function.implode]: Bad arguments. in /home/intranet/public_html/includes/form.inc on line 618.
When I comment out line 1 above, the error goes away. It seems to me like the culprit is the taxonomy_form function. Here is the output of the taxonomy_form function. Notice the [#options] property looks pretty unorthodox, but it still renders the form element OK. I find it hard to believe this code is broken, so I must be missing something obvious.
Array
(
[#type] => select
[#title] => Assignment
[#default_value] => 0
[#options] => Array
(
[0] =>
[1] => stdClass Object
(
[option] => Array
(
[220] => Andrew Jarvis
)
)
[2] => stdClass Object
(
[option] => Array
(
[83] => Bill Bumpus
)
)
)
[#description] =>
[#multiple] => 1
[#size] => 6
[#weight] => -15
[#theme] => taxonomy_term_select
)
Comments
Is this line 3
Counting lines I think the line you are commenting out is
If that is correct, try adding a
'#type' => 'markup',to that form element.No, sorry, the one above it,
No, sorry, the one above it, with taxonomy_form.
--
Prometheus
Some more information
When I output the form in the $element in form.inc, I get the following. It seems it is missing the #parent property which is why it's throwing the error. What do I need to do to the form to get the #parent property into the form?
--
Prometheus
[edit: added closing code tag: nevets]
Problem solved
Was not using drupal_get_form, I was using drupal_render_form(). Oops.
--
Prometheus