Error when using Form Helper and select function
Permalink
Hi, folks.
I'm working on a custom external form that will return pages edited based on a selected user and range of dates. I've got the user selector field working and the from/to date fields working, but I get the following error when I try to include a field to set the number of results per page:
Warning: Invalid argument supplied for foreach() in C:\wamp\www\concrete\concrete\helpers\form.php on line 329
I pulled up the form helper php file and found that line 329 is in the select function. This is the code I am using in my external form that is generating the error:
And here is line 329 in the form helper:
Can someone tell me what I'm doing wrong?
Thanks.
I'm working on a custom external form that will return pages edited based on a selected user and range of dates. I've got the user selector field working and the from/to date fields working, but I get the following error when I try to include a field to set the number of results per page:
Warning: Invalid argument supplied for foreach() in C:\wamp\www\concrete\concrete\helpers\form.php on line 329
I pulled up the form helper php file and found that line 329 is in the select function. This is the code I am using in my external form that is generating the error:
And here is line 329 in the form helper:
foreach($optionValues as $k => $value)
Can someone tell me what I'm doing wrong?
Thanks.
I wasted a full day trying to figure out form helpers especially the select - I think that if your not adding a dynamic option list in the select element than just harcode them in like in the Concrete Widget documentation.
$form->select(array(0 => '',1 => 'Fish',2 => 'Pork',5 => 'Fruit');, $categorySelection, $selectedKeyValue);
I posted a question about being confused and someone graciously explained all about the select ( getting the option list Array from db function )
here
http://www.concrete5.org/index.php?cID=623411&editmode=...
jim
$form->select(array(0 => '',1 => 'Fish',2 => 'Pork',5 => 'Fruit');, $categorySelection, $selectedKeyValue);
I posted a question about being confused and someone graciously explained all about the select ( getting the option list Array from db function )
here
http://www.concrete5.org/index.php?cID=623411&editmode=...
jim
Well I dunno about how gracefully I did it, but it's there.
Campbell, I think that you may have a different problem entirely. My *guess* is that $optionValues is just not an array at that point.
Try running a var_dump on the $optionValues, you may have to check to make sure that it is not null, or that it isn't false or whatever it is actually returning. I suspect you have an error in your code before you even make it to your helper functions.
Campbell, I think that you may have a different problem entirely. My *guess* is that $optionValues is just not an array at that point.
Try running a var_dump on the $optionValues, you may have to check to make sure that it is not null, or that it isn't false or whatever it is actually returning. I suspect you have an error in your code before you even make it to your helper functions.
Here's the format for the select form helper:
It looks like in your code you've left out the array of options that it needs.
Hope this still helps.
-Steven