warning: Invalid argument supplied for foreach()
guix - December 17, 2008 - 14:10
| Project: | Media RSS |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Are you getting this too ?
Add a "feed" view display
Choose MediaRSS in the line style
Click Update, you get this warning :
* warning: Invalid argument supplied for foreach() in /var/www/drupal6/includes/form.inc on line 1193.
* warning: Invalid argument supplied for foreach() in /var/www/drupal6/includes/form.inc on line 1193.

#1
Yeah i am getting this, was testing all from old displays so haven't been adding new ones.
Defaults needed to be set before the style plugin settings loads, which they should do now in 2.x-dev (it won't update till midnight though i don't think but you can download from cvs)
Peter
#2
have u solved your problem?????
#3
Yes Microbe fixed it, 6.x-2.4 is OK for me.
#4
but i m still having this problem can you please tell me how can i solve this problem
#5
do you get the exact same error?
if so it could be caused by another module
#6
...like Panels page computer_jiin ?
http://drupal.org/node/316253
#7
I m getting this error i think this is the same error.
warning: Invalid argument supplied for foreach() in \includes\form.inc on line 1193.
#8
Automatically closed -- issue fixed for two weeks with no activity.
#9
I m also having this error but my module is working fine but tell me how can i remove this error is there any posible way to remove this i have spent lots of time on it but did nt find any solution....any one know about how to remove this error..
the error is ......
* warning: Invalid argument supplied for foreach() \includes\form.inc on line 1193.
* warning: Invalid argument supplied for foreach() in \includes\form.inc on line 1416.
#10
I removed (as far as I know) this error from the media rss module by using function option_definition() in the views class. All the arrays used in the views style / row class options have to be initialized otherwise they give this error.
The media rss code for this is:
<?phpfunction option_definition() {
$options = parent::option_definition();
$options['teaser']['item_length'] = array('default' => 'default');
$options['mediarss_typename'] = array('default' => array());
$options['mediarss_imgfield'] = array('default' => array());
$options['teaser']['mediarss_cachepreset'] = array('default' => array());
$options['teaser']['item_picture_size'] = array('default' => 'preview');
$options['content']['mediarss_cachepreset'] = array('default' => array());
$options['content']['item_picture_size'] = array('default' => '_original');
$options['thumbnail']['mediarss_cachepreset'] = array('default' => array());
$options['thumbnail']['item_picture_size'] = array('default' => 'thumbnail');
return $options;
}
?>
#11
Hi every one ,
I am also having this same issue before many days and today i debug how can i solve this issue actually i was having error ....
warning: Invalid argument supplied for foreach() in \includes\form.inc on line 1193.
I am having this issue and when i debug and comment the code of checkboxes in my module than this error is resolved but i have to use this checkboxes ,check my code if i m missing some minor code and tell me how can i solve this ..
$form['payment_options']['business_payment_method']= array(
'#type' => 'checkboxes',
'#title'=> t('Payment Options'),
'#default_value' => variable_get('business_payment_method',$selected_payment),
'#options' => $payment_options,
);
I am using this tell me if you understand how can i solve this issue ...
Thanks in Advance
Azhar
4 Ace Technologies(www.4acetech.com)
karachi,Pakistan
#12
add this function to the class (check that's its not already there first)
<?php
function option_definition() {
$options = parent::option_definition();
// following line is the one you need to add if the function already exists.
$options['payment_options']['business_payment_method'] = array('default' => array());
return $options;
}
?>
use that line for each form data you use that has checkboxes
#13
Thanks Microbe i have solved this problem.
#14
glad i could help
#15
but Now I am having a new problem, I have understand why i am having this issue but not understanding how can i solve this ,
please check and tell me how can i solve this....
$form['basic_information']['city'] = array(
'#type' => 'select',
'#title' => t('City'),
'#description' => t('Select City.'),
'#required' => TRUE,
//'#options' => array(),
);
I know if i will uncomment #options it will work and error will be remove but actually when i uncomment and than submit i got "An illegal choice has been detected. Please contact the site administrator." And when i comment options illegal choice did nt come,how can i use this options here and i m sending these options from my ajax because i select any country it will show its related cities..
i will send you peice of code of ajax.
<?php
function business_listing_callback() {
$id=$_GET['id'];
$sql="select * from {business_listing_subcategories} where subcategory_id=".$id;
$result=db_query($sql);
while($data =db_fetch_object($result)) {
$output_combo_box.= "<option value='".$data->id."'>".$data->subcategory_name."</option>";
}
drupal_page_header();
if($id == ""){
$output_combo_box.= "<option value='0'>Please Select Subcategory</option>";
}
print drupal_to_js($output_combo_box);
exit();
}
?>
#16
but Now I am having a new problem, I have understand why i am having this issue but not understanding how can i solve this ,
please check and tell me how can i solve this....
$form['basic_information']['city'] = array(
'#type' => 'select',
'#title' => t('City'),
'#description' => t('Select City.'),
'#required' => TRUE,
//'#options' => array(),
);
I know if i will uncomment #options it will work and error will be remove but actually when i uncomment and than submit i got "An illegal choice has been detected. Please contact the site administrator." And when i comment options illegal choice did nt come,how can i use this options here and i m sending these options from my ajax because i select any country it will show its related cities..
i will send you peice of code of ajax.
<?php
function business_listing_callback() {
$id=$_GET['id'];
$sql="select * from {business_listing_subcategories} where subcategory_id=".$id;
$result=db_query($sql);
while($data =db_fetch_object($result)) {
$output_combo_box.= "<option value='".$data->id."'>".$data->subcategory_name."</option>";
}
drupal_page_header();
if($id == ""){
$output_combo_box.= "<option value='0'>Please Select Subcategory</option>";
}
print drupal_to_js($output_combo_box);
exit();
}
?>
Thanks .
#17