Forums

"Notice: Array to string conversion" with checkbox groups

Echo 19 Apr, 2011
Hi,
I have a checkbox group in my form. Whenever one of the checkboxes is checked, after submitting I get this message:

Notice: Array to string conversion in C:\wamp\www\jcms\templates\yougrids\yjsgcore\yjsg_core.php on line 18


And the actions which I set using custom code don't run.

I did some search on this but couldn't find something except using the handle arrays action, which I do.
I'm using RC 1.8, joomla 1.62, running locally with wamp server.
Can anyone Help?

Thanks
GreyHead 19 Apr, 2011
Hi Echo,

Hmmm . . . the error message is coming from your template?? Any idea why that should be?

I suggest that you contact Neo and ask him; I found a similar problem reported in the youjoomla forums.

Bob

PS I just downloaded a copy of the template and it looks as though line 18 is now commented out.
Echo 19 Apr, 2011
oh I didn't notice it was coming from the template, thanks from clarifying this. It's fine with a different template, I'll check it further.
Alexander66 04 May, 2011
In my opinion this notice pops up when the code expects a string but gets an Array.
Like for instance looping through the following array as an example:
$chapters = array(
'harvest' => array('Harvest Manual','Harvest on Time' => array ('monkey','snake','boa'),'Harvest Mecanized', 'Harvest Dammage','Harvest Various', 'Harvest Links'));
The first element of the $chapters[´harvest´] array is a string, the second element is an array and third again a string.
When you loop through this $chapters[´harvest´] (with for instance a foreach) array it will give the annoying notice. You can avoid this by building in the following test:
if(is_array($value))
{$value = $key;}
Because if it is an array you want in realty the key of that new array.
Hope this helps
Alexander66
This topic is locked and no more replies can be posted.