Closed (duplicate)
Project:
Content Construction Kit (CCK)
Version:
6.x-2.5
Component:
number.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
11 Aug 2009 at 16:23 UTC
Updated:
12 Aug 2009 at 20:08 UTC
The code above in number.module on line 232 is not considering the use of optgroups in select's.
foreach ($allowed_values as $kay => $value) {
if ((float) $item['value'] == (float) $kay) {
$valid = TRUE;
break;
}
}
When using optgroups $kay is an array, causing the invalid error message (illegal value).
I think the code above will correct the issue.
foreach ($allowed_values as $kay => $value) {
if (is_array($value))
{
foreach ($value as $k => $v) {
if ((float) $item['value'] == (float) $k) {
$valid = TRUE;
break;
}
}
}
else
{
if ((float) $item['value'] == (float) $kay) {
$valid = TRUE;
break;
}
}
}
Comments
Comment #1
markus_petrux commentedOh, I see. It seems support for optgroups was not as easy as it seemed.
Please, see: #521002: Support for optgroups in allowed values for select elements
Comment #2
markus_petrux commentedPatch posted at #521002: Support for optgroups in allowed values for select elements.
Please test, if you have the chance. Thanks. :)