ceaza, on Sep 15 2005, 12:47 AM, said:
When I use the checkbox or select-multiple options I get "ARRAY" where the Content Variable is called.
If I just check 1 it works, but if I check more that 1 I get the error.
I'm sure there is a fix in the PHP code, but not having looked at that for nearly a year, I'm hesitant to even pull it up.
Here's a possible work around...
create three DocVar fields:
[*ShowMenu1*]
[*ShowMenu2*]
[*ShowMenu3*]
Each one can be a checkbox docvar with only one element in each. for example:
[[ShowMenu1]]
type: checkbox
element: {{Menu1}}
(the state of off or on will determine whether the element is displayed or not.)
... anyway... like I said, this could be solved with a little PHP.
you may want to check this in the root /index.php (mine it's around line 719):
//need to split array
$docvars[$docvar_row['field_name']] = explode("||", $docvar_row['field_value']);
possibly change that to avoid creation of an array type (which is what you see when the page gets rendered). Since the arrays really haven't been utilized, in your case you can just change that line to this:
//need to split array
$docvars[$docvar_row['field_name']] = str_replace ("||","", $docvar_row['field_value']);
If that doesn't work, then you might try this..
/manager/processors/save_content.processor.php
you need to find this code (it's around line 179 in my version):
Quote
// deal with checkboxes & multiple selects elements
$feature_insert = "";
while (list($featureValue, $feature_item) = each ($_POST[$row['field_name']]))
{
$feature_insert = "$feature_insert||$feature_item";
} // end while
// now remove the first two characters
$feature_insert_length = strlen($feature_insert);
$feature_insert_length = $feature_insert_length - 2;
$feature_insert = substr($feature_insert, 2, $feature_insert_length);
$docvars[$row['field_name']] = $feature_insert;
I think this needs to be modified to something more like this:
Quote
// deal with checkboxes & multiple selects elements
$feature_insert = "";
foreach($_POST[$row['field_name']] as $key => $value){
$feature_insert .= "||" . $value;
} // end while
// now remove the first two characters
$feature_insert_length = strlen($feature_insert);
$feature_insert_length = $feature_insert_length - 2;
$feature_insert = substr($feature_insert, 2, $feature_insert_length);
$docvars[$row['field_name']] = $feature_insert;