We get the warning message in the title when opening the question with the our own defined admin/teacher role (not with the student role, not with the superuser/root role)
Question XML:
<question type="check">
<text>In the pressing step K<sub>2</sub>S<sub>2</sub>O<sub>5</sub> is added, which forms SO<sub>2</sub>.
Why do you want to have SO<sub>2</sub> in your product?</text>
<hint>Go to the [node:2980 link=next question;].</hint>
<option><choice>To avoid the growth of unwanted bacteria and yeasts</choice></option>
<option><choice>To promote the extraction of components from the skins into the juice</choice></option>
<option><choice>To increase the body and mouth feel of a wine</choice></option>
<option><choice>To obtain more free-run juice</choice></option>
<option><choice>To avoid chemical and enzymatic oxidation</choice></option>
</question>
Relevant code:
/**
* Helper function to determine the value for a checkboxes form element.
*
* @param $form
* The form element whose value is being populated.
* @param $edit
* The incoming POST data to populate the form element. If this is FALSE,
* the element's default value should be returned.
* @return
* The data that will appear in the $form_state['values'] collection
* for this element. Return nothing to use the default.
*/
function form_type_checkboxes_value($form, $edit = FALSE) {
if ($edit === FALSE) {
$value = array();
$form += array('#default_value' => array());
foreach ($form['#default_value'] as $key) {
$value[$key] = 1;
}
return $value;
}
elseif (!isset($edit)) {
return array();
}
}
Relevant URL:
http://fch.wmmrc.nl/content/food-fermentation-post-test/sulphite
Comments
Comment #1
jvdkolk commentedTested again: Problem seemed to have solved itself :).
Comment #2
pureh2o commentedDag,
I get a similar or the same error:
"Invalid argument supplied for foreach() in form_type_checkboxes_value() (line 2390 of /home/xxxx/public_html/includes/form.inc)."
only for the check type of questions and with reference to this line from form.inc
foreach ($element['#default_value'] as $key) {So maybe there are some other conditions to be met for the bug to be reproduced.
I'm using the 7.x-2.5 version
Happy to help if you need more info from my side.
Comment #3
jvdkolk commentedHi!
Could you post your XML giving this warning in 7.x-2.5?
Best regards,
Koos
Comment #4
pureh2o commentedHi,
I can't reproduce it anymore. 3 days ago I would get it for each and every edit and view, and I did clean the cache...
I'm sure I haven't changed anything on that closedquestion since then.
I have created a new closed question with the same XML and cannot reproduce it still.
The source XML was the one in the sample lessons (you see it's useful to have a baseline):
Bedankt
P.S. Could you please look at the closed issues where I posted new findings (e.g. the issue with the options inlinefeedback)
Comment #5
jvdkolk commented